Skip to content
Gray edited this page Sep 14, 2016 · 1 revision

Description: Clear the values of input elements except button elements, change the values into "" or remove checked or selected.

Options

defaultSelectedIndex

Type: Integer | Default: -1

Default selected index of select elements when clearing inputs.

Code examples:

$('form').clearForm({
    defaultSelectedIndex : 0
});
//or
$('select').clearForm({
    defaultSelectedIndex : 0
});

Events

cleared(event, ui)

Triggered after all inputs in the form or the block was seleted were cleared.

  • event
    Type: Event
  • ui
    Type: Object
  • **item**
    Type: jQuery
    The cleared block.

Note: The event object is empty but included for consistency with other events.

Code examples:

$('form').clearForm({
    cleared : function(event, ui) { }
}});

itemCleared(event, ui)

Triggered after a input was cleared.

  • event
    Type: Event
  • ui
    Type: Object
  • **item**
    Type: jQuery
    The cleared input.

Note: The event object is empty but included for consistency with other events.

Code examples:

$('form').clearForm({
    itemCleared : function(event, ui) { }
}});