InputElement Interface
Input
objects expose the HTMLInputElement (or
HTML 4 HTMLInputElement
) interface, which provides special properties and methods (beyond the regular element object interface they also have available to them by inheritance) for manipulating the layout and presentation of input elements.
Extends
Constructors
Methods
Code bool checkValidity() #
invalid
event at the element. It returns true if the element is not a candidate for constraint validation, or if it satisfies its constraints.
bool checkValidity();
Code InputElementEvents get on() #
InputElementEvents get on();
Code void select() #
void select();
Code void setCustomValidity(String error) #
void setCustomValidity(String error);
Code void setSelectionRange(int start, int end, [String direction]) #
selectionDirection
parameter may be "forward" or "backward" to establish the direction in which selection was set, or "none"if the direction is unknown or not relevant. The default is "none". Specifying selectionDirection
sets the value of the selectionDirection
property.
void setSelectionRange(int start, int end, [String direction]);
Code void stepDown([int n]) #
Decrements the value by (step * n
), where n
defaults to 1 if not specified. Throws an INVALID_STATE_ERR exception:
- if the method is not applicable to for the current type value.
- if the element has no step value.
- if the value cannot be converted to a number.
- if the resulting value is above the max or below the min.
void stepDown([int n]);
Code void stepUp([int n]) #
Increments the value by (step * n
), where n
defaults to 1 if not specified. Throws an INVALID_STATE_ERR exception:
- if the method is not applicable to for the current type value.
- if the element has no step value.
- if the value cannot be converted to a number.
- if the resulting value is above the max or below the min.
void stepUp([int n]);
Fields
Code String autocomplete #
- off: The user must explicitly enter a value into this field for every use, or the document provides its own auto-completion method; the browser does not automatically complete the entry.
- on: The browser can automatically complete the value based on values that the user has entered during previous uses.
String autocomplete;
Code bool autofocus #
autofocus
HTML attribute, which specifies that a form control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form element in a document can have the autofocus attribute. It cannot be applied if the type attribute is set to hidden
(that is, you cannot automatically set focus to a hidden control).
bool autofocus;
Code bool defaultChecked #
bool defaultChecked;
Code String defaultValue #
String defaultValue;
Code final FormElement form #
The containing form element, if this element is in a form. If this element is not contained in a form element:
final FormElement form;
Code String formAction #
formaction
HTML attribute, containing the URI of a program that processes information submitted by the element. If specified, this attribute overrides the
action
attribute of the <form>
element that owns this element.
String formAction;
Code String formMethod #
formmethod
HTML attribute, containing the HTTP method that the browser uses to submit the form. If specified, this attribute overrides the
method
attribute of the <form>
element that owns this element.
String formMethod;
Code bool formNoValidate #
formnovalidate
HTML attribute, indicating that the form is not to be validated when it is submitted. If specified, this attribute overrides the
novalidate
attribute of the <form>
element that owns this element.
bool formNoValidate;
Code String formTarget #
formtarget
HTML attribute, containing a name or keyword indicating where to display the response that is received after submitting the form. If specified, this attribute overrides the
target
attribute of the <form>
element that owns this element.
String formTarget;
Code int maxLength #
Reflects the
maxlength
HTML attribute, containing the maximum length of text (in Unicode code points) that the value can be changed to. The constraint is evaluated only when the value is changed
maxlength
to a negative value programmatically, an exception will be thrown.int maxLength;
Code String pattern #
pattern
HTML attribute, containing a regular expression that the control's value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is text, search, tel, url or email; otherwise it is ignored.
String pattern;
Code String placeholder #
placeholder
HTML attribute, containing a hint to the user of what can be entered in the control. The placeholder text must not contain carriage returns or line-feeds. This attribute applies when the value of the type attribute is text, search, tel, url or email; otherwise it is ignored.
String placeholder;
Code String selectionDirection #
String selectionDirection;
Code int size #
size
HTML attribute, containing size of the control. This value is in pixels unless the value of type is text or password, in which case, it is an integer number of characters.
HTML5 Applies only when type is set to text, search, tel, url, email, or password; otherwise it is ignored.
int size;
Code String step #
step
HTML attribute, which works with min and max to limit the increments at which a numeric or date-time value can be set. It can be the string any or a positive floating point number. If this is not set to any, the control accepts only values at multiples of the step value greater than the minimum.
String step;
Code final String validationMessage #
final String validationMessage;
Code final ValidityState validity #
final ValidityState validity;
Code Date valueAsDate #
null
if conversion is not possible.
Date valueAsDate;
Code num valueAsNumber #
The value of the element, interpreted as one of the following in order:
- a time value
- a number
null
if conversion is not possible
num valueAsNumber;
Code final EntryArray webkitEntries #
final EntryArray webkitEntries;
Code final bool willValidate #
final bool willValidate;
This page includes content from the Mozilla Foundation that is graciously licensed under a Creative Commons: Attribution-Sharealike license. Mozilla has no other association with Dart or dartlang.org. We encourage you to improve the web by contributing to The Mozilla Developer Network.