serializeElements

serializeElements(elements[, getHash = false]) -> string

Serialize an array of form elements to a string suitable for Ajax requests (default behavior) or, if optional getHash evaluates to true, an object hash where keys are form control names and values are data..

The preferred method to serialize a form is Form.serialize. Refer to it for further information and examples on the getHash parameter. However, with serializeElements you can serialize specific input elements of your choice, allowing you to specify a subset of form elements that you want to serialize data from.

Example

To serialize all input elements of type "text":


Form.serializeElements( $('myform').getInputs('text') )
// -> serialized data