serializeArray() method in Jquery

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:

<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>

Output:

dotnet-helpers-jquery-serializearray-method-jquery-helpers-com-thiyagu

One thought on “serializeArray() method in Jquery”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.