Input is a basic dom-wrapper for all the input elements, like text fields, selects, textareas, etc. It inherited from the Element class and has partly shared interface.
Unlike other DOM elements, form elements handle a bunch of additional events:
They are handled simultaneously with all the other events. All shortcuts are in place, you can wire and run the events the usual way.
include, initialize, blur, checked, disable, disabled, enable, focus, form, getValue, select, setValue, value
include(Object methods[, boolean dont_rewrite])
Registers additional methods for the form input element units, like INPUT, SELECT, TEXTAREA.
Input.include({
myMethod: function() {....}
});
$('my_input').myMethod();
initialize(raw_dom_element) -> Input
initialize(Object options) -> Input
Basic constructor. It might take a raw dom input element or all the standard Element options, plus an uniformed option of type, which can be one of the standard INPUT tag types or one of the following
text - is the default value
new Input(); // -> input#text
new Input({type: 'radio'}) // -> input#radio
new Input({type: 'textarea'}) // -> textarea
new Input({type: 'select'}) // -> selectbox
blur() -> Element self
Looses the focus on the element.
$(
'input').blur();
checked() -> boolean
checked(value) -> Input self
A bidirectional method to work with the checked property
$(input).checked(true);
$(input).checked(); // -> true
$(input).checked(false);
$(input).checked(); // -> false
disable() -> Element self
Disables the element.
$(
'element').disable();
disabled() -> boolean
disabled(value) -> Input self
A bidirectional method to work with the disabled property
$(input).disabled(true);
$(input).disabled(); // -> true
$(input).disabled(false);
$(input).disabled(); // -> false
focus() -> Element self
Puts the focus on the element.
$(
'input').focus();
form() -> Form
Returns a wrapped form object to which this input field belongs to
$(input).form().submit();
getValue() -> mixed value
Unified access to get a form element value.
$(
'input').getValue();
$('select').getValue();
$('textarea').getValue();
$('multi-select').getValue();
select() -> Element self
Puts the focus on the element and selects its data.
$(
'input').select();