instance method Form#getInputs

View source on GitHub →

Form#getInputs([type [, name]]) → [Element…]
  • type (String) – A value for the type attribute against which to filter.
  • name (String) – A value for the name attribute against which to filter.

Returns a collection of all INPUT elements in a form.

Use optional type and name arguments to restrict the search on these attributes.

Example
var form = $('myform');
 form.getInputs();       // -> all INPUT elements
form.getInputs('text'); // -> only text inputs
 var buttons = form.getInputs('radio', 'education');
// -> only radio buttons of name "education"
 // now disable these radio buttons:
buttons.invoke('disable');
Note

Elements are returned in the document order, not the tabindex order.

This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.