Description:
The jQuery serializedArray() Method is used to create a array of string by serializing form values. It operates on a collection of forms and its controls. We can select one or more form elements such as <input>, <textarea> or the form element itself.
Syntax
$(selector).serializeArray()ย
No Arguments | This method does not accept any arguments. |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"> </script> <script type="text/javascript"> $(document).ready(function () { $("#btnSubmit").click(function () { $("#divOutpu").text($("form").serialize()); }); }); </script> </head> <body> <form> Enter Your First name: <input type="text" name="FirstName"><br> Enter Your Last name: <input type="text" name="LastName"><br> Enter Your Age: <input type="text" name="Age" style="margin-left:35px;"><br> </form> <br> <button id="btnSubmit">Serialize form values</button><br><br> <div id="divOutpu" style="background-color:#6fb5ef; font-size:large; width:600px;color:black;"></div> </body> </html> |
This post have resolved my problem,thanks very much and hope you writting more good articles.