serializeArray() Method - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:serializeArray


The serializeArray() method creates an array of objects (name and value) by serializing form values.

The following code shows how to Output the result of form values serialized as arrays:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<script src=""></script>
        var x = $("form").serializeArray();
        $.each(x, function(i, field){
            $("#results").append( + ":" + field.value + " ");
        });//w w  w.  j  a  v a  2  s  . c o  m

<form action="">
  First name: <input type="text" name="FirstName" value="Bond"><br>
  Last name: <input type="text" name="LastName" value="Mary"><br>

<button>Serialize form values</button>

<div id="results"></div>


Related Tutorials