Skip to content
Advertisement

How to serialize current div by using $(this).parent() with JQuery?

I am trying to serialize the current div by using a clickevent. See code for good explanation:

JavaScript

Alert will show nothing, which means the div is not being serialized. This is the html in question. It’s inside a dialog, which is also the reason why I have to use live().

JavaScript

Also this code is working without a problem to remove the current div by using the clickevent and parent selector.

JavaScript

Advertisement

Answer

You can serialize a <div>.

The serialize uses internally the param method. So to serialize input elements that do not belong to a form, use the param method. Example: http://jsfiddle.net/DdVqJ/

But remember, the correct (and semantic) way is to put your input elements inside a form.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement