Jquery Serialize Example - Jquery

How to serialize element using jquery?

Snippet Code

Rate this page :
  [ 0 votes]

The serialize() method is used to create array of objects. This method creates a url like encode string through serializing the form values. Serialize method allows you to select more form elements in itself. The code to serialize the element using jquery is given below.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $(document).ready(function(){ $("#btn").click(function(){ $("div").text($("form").serialize()); }); }); </script> <form action=""> Name: <input type="text" name="Name" value="Mickey"></br> Age: <input type="text" name="age" value="40"></br> </form> <input type='button' id='btn' value='Serialize Form Values'></br></br> <div></div>


Ask Questions

Ask Question