Prev Demo
jQuery
>
.Serialize() - Serialize Html Form Data
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> </head> <body> <form method="post" action="somepage.html"> <input type="button" id="btnSerialize" value="Serialize data" /> <textarea id="divData" name="txtArea1" rows="10" cols="50"></textarea> </form> <script> $("#btnSerialize").click(function () { var data = $("form").serialize(); $("#divData").val(data); }); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output