Skip to content
Advertisement

How to get all form elements values using jQuery?

Here is the HTML code:

JavaScript

Here the code which will get all form field values:

JavaScript

From this I am getting the output value as follows:

JavaScript

I want the out as following:

JavaScript

Advertisement

Answer

You can use a serialize() function of JQuery:

JavaScript

And read in PHP:

JavaScript

And get ***data-**** to tag HTML5 you can see this example:

JavaScript

JavaScript

And

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