From 9961b363abaf8dcd32694d55f6f2d756d247f6ff Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Tue, 22 Jul 2014 12:38:49 -0400 Subject: [PATCH] serializeArray(): Improve description of valid input elements Ref jQuery #15191 --- entries/serializeArray.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entries/serializeArray.xml b/entries/serializeArray.xml index a86f1373..bc46e920 100644 --- a/entries/serializeArray.xml +++ b/entries/serializeArray.xml @@ -6,7 +6,7 @@ Encode a set of form elements as an array of names and values. -

The .serializeArray() method creates a JavaScript array of objects, ready to be encoded as a JSON string. It operates on a jQuery object representing a set of form elements. The form elements can be of several types:

+

The .serializeArray() method creates a JavaScript array of objects, ready to be encoded as a JSON string. It operates on a jQuery collection of forms and/or form controls. The controls can be of several types:


 <form>
   <div><input type="text" name="a" value="1" id="a"></div>
@@ -29,7 +29,7 @@
 </form>
     

The .serializeArray() method uses the standard W3C rules for successful controls to determine which elements it should include; in particular the element cannot be disabled and must contain a name attribute. No submit button value is serialized since the form was not submitted using a button. Data from file select elements is not serialized.

-

This method can act on a jQuery object that has selected individual form elements, such as <input>, <textarea>, and <select>. However, it is typically easier to select the <form> tag itself for serialization:

+

This method can act on a jQuery object that has selected individual form controls, such as <input>, <textarea>, and <select>. However, it is typically easier to select the <form> element itself for serialization:


 $( "form" ).submit(function( event ) {
   console.log( $( this ).serializeArray() );