Skip to content
Related Articles

Related Articles

Improve Article

How to get form data using JavaScript/jQuery?

  • Last Updated : 23 May, 2019

The serializeArray() method creates an array of objects (name and value) by serializing form values. This method can be used to get the form data.



Parameter: It does not accept any parameter.

Return Value: It returns all the value that is inside the inputs fields.


<!DOCTYPE html>
    <script src=
        $(document).ready(function() {
            $("button").click(function() {
                var x = $("form").serializeArray();
                $.each(x, function(i, field) {
                    $("#output").append( + ":"
                            + field.value + " ");
        #GFG {
            width: 300px;
            padding: 50px;
            height: 150px;
            border: 2px solid green;
    <div id="GFG">
        <form action="#">
            Name: <input type="text" 
                style="margin: 10px;" name="Name">
    <div id="output"></div>


  • Before clicking the button:
  • After clicking the button:

My Personal Notes arrow_drop_up
Recommended Articles
Page :