Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

HTMLInputElement object

Implements the document object model (DOM) representation of the input element.

Internet Explorer 9

 

DOM Information

Inheritance Hierarchy

 Node
  Element
   HTMLElement
     HTMLInputElement

Members

The HTMLInputElement object has these types of members:

Methods

The HTMLInputElement object has these methods.

MethodDescription
checkValidity

Returns whether a form will validate when it is submitted, without having to submit it.

getBoundingClientRect

Retrieves an object that specifies the bounds of a collection of TextRectangle objects.

getClientRects

Retrieves a collection of rectangles that describes the layout of the contents of an object or range within the client. Each rectangle describes a single line.

setCustomValidity

Sets a custom error message that is displayed when a form is submitted.

stepDown

Decrements a range input control's value by the value given by the Step attribute.

stepUp

Increments a range input control's value by the value given by the Step attribute.

 

Properties

The HTMLInputElement object has these properties.

PropertyAccess typeDescription

autocomplete

Read/write

Specifies whether autocomplete is applied to an editable text field.

autofocus

Read/write

Provides a way to direct a user to a specific field when a document loads.

files

Read-only

Returns a FileList object on a file type input object.

formAction

Read/write

Overrides the action attribute (where the data on a form is sent) on the parent form element.

formEnctype

Read/write

Used to override the encoding (formEnctype attribute) specified on the form element.

formMethod

Read/write

Overrides the submit method attribute previously specified on a form element.

formNoValidate

Read/write

Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation.

formTarget

Read/write

Overrides the target attribute on a form element.

list

Read-only

Specifies the ID of a pre-defined datalist of options for an input element.

max

Read/write

Defines the maximum acceptable value for an input element with type="number".

maxLength

Sets or retrieves the maximum number of characters that the user can enter in a text control.

min

Read/write

Defines the minimum acceptable value for an input element with type="number".

multiple

Read/write

When used with the type="file" attribute, allows multiple files to be selected in the file selection dialog.

pattern

Read/write

Gets or sets a string containing a regular expression that the user's input must match.

placeholder

Read/write

Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.

required

Read/write

When present, marks an element that can't be submitted without a value.

selectionEnd

Gets or sets the end position or offset of a text selection.

selectionStart

Gets or sets the starting position or offset of a text selection.

spellcheck

Read/write

Specifies whether spell checking is applied to an editable text field.

src

Sets or retrieves a URL to be loaded by the object.

step

Read/write

Defines an increment or jump between values that you want to allow the user to enter.

type

Retrieves or initially sets the type of input control represented by the object.

validationMessage

Read-only

Returns the error message that would be displayed if the user submits the form, or an empty string if no error message.

validity

Read-only

Returns a ValidityState object that represents the validity states of an element.

valueAsNumber

Read/write

Returns the input field value as a number.

willValidate

Read-only

Returns whether an element will successfully validate based on forms validation rules and constraints.

 

 

 

Show:
© 2014 Microsoft