Using jQuery, how can I obtain form data from fields that have been added by manipulating the DOM?
I have a tab开发者_开发知识库le body that grabs it's rows (and form fields) via AJAX on various events. Everything is working fine, except one part: I can't obtain form data from any of the table's rows after it gets manipulated.
I've played around with the live() function, but I can't seem to get the right setup to pull in the form data.
Any ideas?
Have you tried http://api.jquery.com/serialize/ ?
everything inside the DOM is accessible from jquery no matter how it got added/manipulated..
Show us some code of what you do and what you want to do if you want a more detailed answer...
I found the issue in my code. Upon rebuilding the table, I had a slightly different field name for the fields than I used when building the table on page load.
Thank you for your quick responses.
It sounds like you may need to re-factor that code such that the same code that builds the table at page load also rebuilds it later on.
精彩评论