jQuery serializeArray()

Some important features of jQuery serializeArray() method are:

  • jQuery serializeArray() method creates a JavaScript array of objects.
  • One can select one or more form elements, as it operates on a jQuery collection of forms and form controls.
  • It serializes the form values.


$ (selector).serializeArray()  

Example 1

<!DOCTYPE html>  
 <script src="https://code.jquery.com/jquery-1.10.2.js"></script>  
 var x = $("form").serializeArray();  
    	$.each(x, function(i, field){  
        	$("#results").append(field.name + ":" + field.value + " ");  
<form action="">  
  First name: <input type="text" name="Mailid" value="test.com"><br>  
  Last name: <input type="text" name="UserName" value="Jai"><br>  
<div id="results"></div>  

Try it

JS Bin on jsbin.com

Content Protection by DMCA.com
Please Share