Avatar of Keith McElroy
Keith McElroy

asked on 

jquery serialize a collection of tables

how can I get the individual tables in this each loop to display .serialize()

Screenshot:  http://www.screencast.com/t/w59pGCrThT

Currently the .serialize is blank yet the table has several inputs all with name and id

            var serializedcontent = ""
            $(target).closest('div').find('table').each(function(){
                  if($(this).attr("id"))
                  {
                        if($(this).attr("id").indexOf("BT20") > -1)
                        {
                        alert($(this).attr("id") + "~" + $('table#' + $(this).attr("id")).serialize())      
                        serializedcontent += $(this).attr("id") + "~" + $(this).serialize() + "^"
                        }
                  }
                  
            })
jQuery

Avatar of undefined
Last Comment
Kim Walker
Avatar of leakim971
leakim971
Flag of Guadeloupe image

do a right click on this closest div and paste here this collection of table.
Avatar of Kim Walker
Kim Walker
Flag of United States of America image

The total absence of semi-colons in your code is suspect. Is anything happening at all? Are you getting an alert? Does the alert contain the id and tilde but not the serialized id?

I am unfamiliar with the use of serialize on an attribute. The serialize function is typically executed on a form element. In fact, the documentation states
For a form element's value to be included in the serialized string, the element must have a name attribute.
But in your case, you are serializing the value of the id attribute of the target element. What do you expect the serialize function to return in this case?
ASKER CERTIFIED SOLUTION
Avatar of Kim Walker
Kim Walker
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
jQuery
jQuery

jQuery (Core) is a cross-browser JavaScript library that provides abstractions for common client-side tasks such as Document Object Model (DOM) traversal, DOM manipulation, event handling, animation and Ajax. jQuery also provides a platform to create plugins that extend jQuery's capabilities beyond those already provided by the library.

19K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo