public interface InputElement extends Element
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.ALLOW_KEYBOARD_INPUT
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
Modifier and Type | Method and Description |
---|---|
boolean |
checkValidity()
Returns false if the element is a candidate for constraint validation, and it does not satisfy its constraints.
|
String |
getAccept()
Reflects the
accept
HTML attribute, containing comma-separated list of file types accepted by the server when type is file . |
String |
getAlign()
Alignment of the element.
|
String |
getAlt()
Reflects the
alt
HTML attribute, containing alternative text to use when type is image. |
String |
getAutocomplete()
Reflects the {{htmlattrxref("autocomplete", "input)}} HTML attribute, indicating whether the value of the control can be automatically completed by the browser.
|
String |
getDefaultValue()
The default value as originally specified in HTML that created this object.
|
String |
getDirName() |
FileList |
getFiles()
A list of selected files.
|
FormElement |
getForm()
The containing form element, if this element is in a form.
|
String |
getFormAction()
Reflects the
formaction
HTML attribute, containing the URI of a program that processes information submitted by the element. |
String |
getFormEnctype() |
String |
getFormMethod()
Reflects the
formmethod
HTML attribute, containing the HTTP method that the browser uses to submit the form. |
String |
getFormTarget()
Reflects the
formtarget
HTML attribute, containing a name or keyword indicating where to display the response that is received after submitting the form. |
int |
getHeight()
Reflects the
height
HTML attribute, which defines the height of the image displayed for the button, if the value of type is image. |
NodeList |
getLabels()
A list of
<label>
elements that are labels for this element. |
String |
getMax()
Reflects the
max
HTML attribute, containing the maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value. |
int |
getMaxLength()
Reflects the
maxlength
HTML attribute, containing the maximum length of text (in Unicode code points) that the value can be changed to. |
String |
getMin()
Reflects the
min
HTML attribute, containing the minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value. |
String |
getName()
Reflects the
name
HTML attribute, containing a name that identifies the element when submitting the form. |
EventListener |
getOnwebkitspeechchange() |
String |
getPattern()
Reflects the
pattern
HTML attribute, containing a regular expression that the control's value is checked against. |
String |
getPlaceholder()
Reflects the
placeholder
HTML attribute, containing a hint to the user of what can be entered in the control. |
String |
getSelectionDirection()
The direction in which selection occurred.
|
int |
getSelectionEnd()
The index of the end of selected text.
|
int |
getSelectionStart()
The index of the beginning of selected text.
|
int |
getSize()
Reflects the
size
HTML attribute, containing size of the control. |
String |
getSrc()
Reflects the
src
HTML attribute, which specifies a URI for the location of an image to display on the graphical submit button, if the value of type is image; otherwise it is ignored. |
String |
getStep()
Reflects the
step
HTML attribute, which works with min and max to limit the increments at which a numeric or date-time value can be set. |
String |
getType()
Reflects the
type
HTML attribute, indicating the type of control to display. |
String |
getUseMap()
A client-side image map.
|
String |
getValidationMessage()
A localized message that describes the validation constraints that the control does not satisfy (if any).
|
ValidityState |
getValidity()
The validity states that this element is in.
|
String |
getValue()
Current value in the control.
|
Date |
getValueAsDate()
The value of the element, interpreted as a date, or
null if conversion is not possible. |
double |
getValueAsNumber()
The value of the element, interpreted as one of the following in order:
|
int |
getWidth()
Reflects the
width
HTML attribute, which defines the width of the image displayed for the button, if the value of type is image. |
boolean |
isAutofocus()
Reflects the
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. |
boolean |
isChecked()
The current state of the element when type is
checkbox or radio . |
boolean |
isDefaultChecked()
The default state of a radio button or checkbox as originally specified in HTML that created this object.
|
boolean |
isDisabled()
Reflects the
disabled
HTML attribute, indicating that the control is not available for interaction. |
boolean |
isFormNoValidate()
Reflects the
formnovalidate
HTML attribute, indicating that the form is not to be validated when it is submitted. |
boolean |
isIncremental() |
boolean |
isIndeterminate()
Indicates that a checkbox is neither on nor off.
|
boolean |
isMultiple()
Reflects the
multiple
HTML attribute, indicating whether more than one value is possible (e.g., multiple files). |
boolean |
isReadOnly()
Reflects the
readonly
HTML attribute, indicating that the user cannot modify the value of the control. |
boolean |
isRequired()
Reflects the
required
HTML attribute, indicating that the user must fill in a value before submitting a form. |
boolean |
isWebkitdirectory() |
boolean |
isWebkitGrammar() |
boolean |
isWebkitSpeech() |
boolean |
isWillValidate()
Indicates whether the element is a candidate for constraint validation.
|
void |
select()
Selects the input text in the element, and focuses it so the user can subsequently replace the whole entry.
|
void |
setAccept(String arg) |
void |
setAlign(String arg) |
void |
setAlt(String arg) |
void |
setAutocomplete(String arg) |
void |
setAutofocus(boolean arg) |
void |
setChecked(boolean arg) |
void |
setCustomValidity(String error)
Sets a custom validity message for the element.
|
void |
setDefaultChecked(boolean arg) |
void |
setDefaultValue(String arg) |
void |
setDirName(String arg) |
void |
setDisabled(boolean arg) |
void |
setFiles(FileList arg) |
void |
setFormAction(String arg) |
void |
setFormEnctype(String arg) |
void |
setFormMethod(String arg) |
void |
setFormNoValidate(boolean arg) |
void |
setFormTarget(String arg) |
void |
setHeight(int arg) |
void |
setIncremental(boolean arg) |
void |
setIndeterminate(boolean arg) |
void |
setMax(String arg) |
void |
setMaxLength(int arg) |
void |
setMin(String arg) |
void |
setMultiple(boolean arg) |
void |
setName(String arg) |
void |
setOnwebkitspeechchange(EventListener arg) |
void |
setPattern(String arg) |
void |
setPlaceholder(String arg) |
void |
setReadOnly(boolean arg) |
void |
setRequired(boolean arg) |
void |
setSelectionDirection(String arg) |
void |
setSelectionEnd(int arg) |
void |
setSelectionRange(int start,
int end)
Selects a range of text in the element (but does not focus it).
|
void |
setSelectionRange(int start,
int end,
String direction)
Selects a range of text in the element (but does not focus it).
|
void |
setSelectionStart(int arg) |
void |
setSize(int arg) |
void |
setSrc(String arg) |
void |
setStep(String arg) |
void |
setType(String arg) |
void |
setUseMap(String arg) |
void |
setValue(String arg) |
void |
setValueAsDate(Date arg) |
void |
setValueAsNumber(double arg) |
void |
setWebkitdirectory(boolean arg) |
void |
setWebkitGrammar(boolean arg) |
void |
setWebkitSpeech(boolean arg) |
void |
setWidth(int arg) |
void |
stepDown()
Decrements the value by (step *
n ), where n defaults to 1 if not specified. |
void |
stepDown(int n)
Decrements the value by (step *
n ), where n defaults to 1 if not specified. |
void |
stepUp()
Increments the value by (step *
n ), where n defaults to 1 if not specified. |
void |
stepUp(int n)
Increments the value by (step *
n ), where n defaults to 1 if not specified. |
blur, click, focus, getAccessKey, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getBoundingClientRect, getChildElementCount, getChildren, getClassList, getClassName, getClientHeight, getClientLeft, getClientRects, getClientTop, getClientWidth, getContentEditable, getDataset, getDir, getElementsByClassName, getElementsByTagName, getElementsByTagNameNS, getFirstElementChild, getId, getInnerHTML, getInnerText, getLang, getLastElementChild, getNextElementSibling, getOffsetHeight, getOffsetLeft, getOffsetParent, getOffsetTop, getOffsetWidth, getOnabort, getOnbeforecopy, getOnbeforecut, getOnbeforepaste, getOnblur, getOnchange, getOnclick, getOncontextmenu, getOncopy, getOncut, getOndblclick, getOndrag, getOndragend, getOndragenter, getOndragleave, getOndragover, getOndragstart, getOndrop, getOnerror, getOnfocus, getOninput, getOninvalid, getOnkeydown, getOnkeypress, getOnkeyup, getOnload, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnmousewheel, getOnpaste, getOnreset, getOnscroll, getOnsearch, getOnselect, getOnselectstart, getOnsubmit, getOntouchcancel, getOntouchend, getOntouchmove, getOntouchstart, getOnwebkitfullscreenchange, getOnwebkitfullscreenerror, getOuterHTML, getOuterText, getPreviousElementSibling, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getStyle, getTabIndex, getTagName, getTitle, getWebkitdropzone, getWebkitRegionOverflow, hasAttribute, hasAttributeNS, insertAdjacentElement, insertAdjacentHTML, insertAdjacentText, isContentEditable, isDraggable, isHidden, isSpellcheck, isTranslate, querySelector, querySelectorAll, removeAttribute, removeAttributeNode, removeAttributeNS, scrollByLines, scrollByPages, scrollIntoView, scrollIntoView, scrollIntoViewIfNeeded, scrollIntoViewIfNeeded, setAccessKey, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setClassName, setContentEditable, setDir, setDraggable, setHidden, setId, setInnerHTML, setInnerText, setLang, setOnabort, setOnbeforecopy, setOnbeforecut, setOnbeforepaste, setOnblur, setOnchange, setOnclick, setOncontextmenu, setOncopy, setOncut, setOndblclick, setOndrag, setOndragend, setOndragenter, setOndragleave, setOndragover, setOndragstart, setOndrop, setOnerror, setOnfocus, setOninput, setOninvalid, setOnkeydown, setOnkeypress, setOnkeyup, setOnload, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnmousewheel, setOnpaste, setOnreset, setOnscroll, setOnsearch, setOnselect, setOnselectstart, setOnsubmit, setOntouchcancel, setOntouchend, setOntouchmove, setOntouchstart, setOnwebkitfullscreenchange, setOnwebkitfullscreenerror, setOuterHTML, setOuterText, setScrollLeft, setScrollTop, setSpellcheck, setTabIndex, setTitle, setTranslate, setWebkitdropzone, webkitMatchesSelector, webkitRequestFullscreen, webkitRequestFullScreen
addEventListener, addEventListener, appendChild, cloneNode, compareDocumentPosition, contains, dispatchEvent, getAttributes, getBaseURI, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPrefix, getPreviousSibling, getTextContent, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, removeEventListener, removeEventListener, replaceChild, setNodeValue, setPrefix, setTextContent
String getAccept()
accept
HTML attribute, containing comma-separated list of file types accepted by the server when type is file
.void setAccept(String arg)
void setAlign(String arg)
String getAlt()
alt
HTML attribute, containing alternative text to use when type is image.
void setAlt(String arg)
String getAutocomplete()
void setAutocomplete(String arg)
boolean isAutofocus()
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).void setAutofocus(boolean arg)
boolean isChecked()
checkbox
or radio
.void setChecked(boolean arg)
boolean isDefaultChecked()
void setDefaultChecked(boolean arg)
String getDefaultValue()
void setDefaultValue(String arg)
String getDirName()
void setDirName(String arg)
boolean isDisabled()
disabled
HTML attribute, indicating that the control is not available for interaction.void setDisabled(boolean arg)
FileList getFiles()
void setFiles(FileList arg)
FormElement getForm()
The containing form element, if this element is in a form. If this element is not contained in a form element:
String getFormAction()
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.void setFormAction(String arg)
String getFormEnctype()
void setFormEnctype(String arg)
String getFormMethod()
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.void setFormMethod(String arg)
boolean isFormNoValidate()
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.void setFormNoValidate(boolean arg)
String getFormTarget()
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.void setFormTarget(String arg)
int getHeight()
height
HTML attribute, which defines the height of the image displayed for the button, if the value of type is image.void setHeight(int arg)
boolean isIncremental()
void setIncremental(boolean arg)
boolean isIndeterminate()
void setIndeterminate(boolean arg)
String getMax()
max
HTML attribute, containing the maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value.void setMax(String arg)
int getMaxLength()
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.void setMaxLength(int arg)
String getMin()
min
HTML attribute, containing the minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value.void setMin(String arg)
boolean isMultiple()
multiple
HTML attribute, indicating whether more than one value is possible (e.g., multiple files).void setMultiple(boolean arg)
String getName()
name
HTML attribute, containing a name that identifies the element when submitting the form.void setName(String arg)
EventListener getOnwebkitspeechchange()
void setOnwebkitspeechchange(EventListener arg)
String getPattern()
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.void setPattern(String arg)
String getPlaceholder()
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.void setPlaceholder(String arg)
boolean isReadOnly()
void setReadOnly(boolean arg)
boolean isRequired()
required
HTML attribute, indicating that the user must fill in a value before submitting a form.void setRequired(boolean arg)
String getSelectionDirection()
void setSelectionDirection(String arg)
int getSelectionEnd()
void setSelectionEnd(int arg)
int getSelectionStart()
void setSelectionStart(int arg)
int getSize()
void setSize(int arg)
String getSrc()
src
HTML attribute, which specifies a URI for the location of an image to display on the graphical submit button, if the value of type is image; otherwise it is ignored.void setSrc(String arg)
String getStep()
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.void setStep(String arg)
String getType()
void setType(String arg)
void setUseMap(String arg)
String getValidationMessage()
ValidityState getValidity()
String getValue()
void setValue(String arg)
Date getValueAsDate()
null
if conversion is not possible.void setValueAsDate(Date arg)
double getValueAsNumber()
The value of the element, interpreted as one of the following in order:
null
if conversion is not possiblevoid setValueAsNumber(double arg)
boolean isWebkitGrammar()
void setWebkitGrammar(boolean arg)
boolean isWebkitSpeech()
void setWebkitSpeech(boolean arg)
boolean isWebkitdirectory()
void setWebkitdirectory(boolean arg)
int getWidth()
width
HTML attribute, which defines the width of the image displayed for the button, if the value of type is image.void setWidth(int arg)
boolean isWillValidate()
boolean 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.void select()
void setCustomValidity(String error)
void setSelectionRange(int start, int end)
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)
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 stepDown()
Decrements the value by (step * n
), where n
defaults to 1 if not specified. Throws an INVALID_STATE_ERR exception:
void stepDown(int n)
Decrements the value by (step * n
), where n
defaults to 1 if not specified. Throws an INVALID_STATE_ERR exception:
void stepUp()
Increments the value by (step * n
), where n
defaults to 1 if not specified. Throws an INVALID_STATE_ERR exception:
void stepUp(int n)
Increments the value by (step * n
), where n
defaults to 1 if not specified. Throws an INVALID_STATE_ERR exception:
Copyright © 2018. All rights reserved.