Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

HTMLInputElement

Provides special properties and methods for manipulating the options, layout, and presentation of elements.

interface HTMLInputElement extends HTMLElement {
accept: string;
align: string;
alt: string;
autocomplete: string;
capture: string;
checked: boolean;
defaultChecked: boolean;
defaultValue: string;
dirName: string;
disabled: boolean;
files: FileList | null;
readonly form: HTMLFormElement | null;
formAction: string;
formEnctype: string;
formMethod: string;
formNoValidate: boolean;
formTarget: string;
height: number;
indeterminate: boolean;
readonly labels: NodeListOf<HTMLLabelElement> | null;
readonly list: HTMLElement | null;
max: string;
maxLength: number;
min: string;
minLength: number;
multiple: boolean;
name: string;
pattern: string;
placeholder: string;
readOnly: boolean;
required: boolean;
selectionDirection:
| "forward"
| "backward"
| "none"
| null;
selectionEnd: number | null;
selectionStart: number | null;
size: number;
src: string;
step: string;
type: string;
useMap: string;
readonly validationMessage: string;
readonly validity: ValidityState;
value: string;
valueAsDate: Date | null;
valueAsNumber: number;
webkitdirectory: boolean;
readonly webkitEntries: ReadonlyArray<FileSystemEntry>;
width: number;
readonly willValidate: boolean;
addEventListener<K extends keyof HTMLElementEventMap>(
type: K,
listener: (this: HTMLInputElement, ev: HTMLElementEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void;
checkValidity(): boolean;
removeEventListener<K extends keyof HTMLElementEventMap>(
type: K,
listener: (this: HTMLInputElement, ev: HTMLElementEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void;
reportValidity(): boolean;
select(): void;
setCustomValidity(error: string): void;
setRangeText(replacement: string): void;
setRangeText(
replacement: string,
start: number,
end: number,
selectionMode?: SelectionMode,
): void;
setSelectionRange(
start: number | null,
end: number | null,
direction?: "forward" | "backward" | "none",
): void;
showPicker(): void;
stepDown(n?: number): void;
stepUp(n?: number): void;
}
var HTMLInputElement: {
prototype: HTMLInputElement;
}
;

§Extends

§Properties

§
accept: string
[src]

Sets or retrieves a comma-separated list of content types.

§
align: string
[src]

Sets or retrieves how the object is aligned with adjacent text.

§
alt: string
[src]

Sets or retrieves a text alternative to the graphic.

§
autocomplete: string
[src]

Specifies whether autocomplete is applied to an editable text field.

§
capture: string
[src]
§
checked: boolean
[src]

Sets or retrieves the state of the check box or radio button.

§
defaultChecked: boolean
[src]

Sets or retrieves the state of the check box or radio button.

§
defaultValue: string
[src]

Sets or retrieves the initial contents of the object.

§
dirName: string
[src]
§
disabled: boolean
[src]
§
files: FileList | null
[src]

Returns a FileList object on a file type input object.

§
readonly form: HTMLFormElement | null
[src]

Retrieves a reference to the form that the object is embedded in.

§
formAction: string
[src]

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

§
formEnctype: string
[src]

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

§
formMethod: string
[src]

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

§
formNoValidate: boolean
[src]

Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option.

§
formTarget: string
[src]

Overrides the target attribute on a form element.

§
height: number
[src]

Sets or retrieves the height of the object.

§
indeterminate: boolean
[src]

When set, overrides the rendering of checkbox controls so that the current value is not visible.

§
readonly labels: NodeListOf<HTMLLabelElement> | null
[src]
§
readonly list: HTMLElement | null
[src]

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

§
max: string
[src]

Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field.

§
maxLength: number
[src]

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

§
min: string
[src]

Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field.

§
minLength: number
[src]
§
multiple: boolean
[src]

Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.

§
name: string
[src]

Sets or retrieves the name of the object.

§
pattern: string
[src]

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

§
placeholder: string
[src]

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.The text appears in an input field until the user puts focus on the field.

§
readOnly: boolean
[src]
§
required: boolean
[src]

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

§
selectionDirection: "forward" | "backward" | "none" | null
[src]
§
selectionEnd: number | null
[src]

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

§
selectionStart: number | null
[src]

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

§
size: number
[src]
§
src: string
[src]

The address or URL of the a media resource that is to be considered.

§
step: string
[src]

Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field.

§
type: string
[src]

Returns the content type of the object.

§
useMap: string
[src]

Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.

§
readonly validationMessage: string
[src]

Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting.

§
readonly validity: ValidityState
[src]

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

§
value: string
[src]

Returns the value of the data at the cursor's current position.

§
valueAsDate: Date | null
[src]

Returns a Date object representing the form control's value, if applicable; otherwise, returns null. Can be set, to change the value. Throws an "InvalidStateError" DOMException if the control isn't date- or time-based.

§
valueAsNumber: number
[src]

Returns the input field value as a number.

§
webkitdirectory: boolean
[src]
§
readonly webkitEntries: ReadonlyArray<FileSystemEntry>
[src]
§
width: number
[src]

Sets or retrieves the width of the object.

§
readonly willValidate: boolean
[src]

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

§Methods

§
addEventListener<K extends keyof HTMLElementEventMap>(
type: K,
listener: (this: HTMLInputElement, ev: HTMLElementEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void
[src]
§
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void
[src]
§
checkValidity(): boolean
[src]

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

§
removeEventListener<K extends keyof HTMLElementEventMap>(
type: K,
listener: (this: HTMLInputElement, ev: HTMLElementEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void
[src]
§
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void
[src]
§
reportValidity(): boolean
[src]
§
select(): void
[src]

Makes the selection equal to the current object.

§
setCustomValidity(error: string): void
[src]

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

@param error

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

§
setRangeText(replacement: string): void
[src]
§
setRangeText(
replacement: string,
start: number,
end: number,
selectionMode?: SelectionMode,
): void
[src]
§
setSelectionRange(
start: number | null,
end: number | null,
direction?: "forward" | "backward" | "none",
): void
[src]

Sets the start and end positions of a selection in a text field.

@param start

The offset into the text field for the start of the selection.

@param end

The offset into the text field for the end of the selection.

@param direction

The direction in which the selection is performed.

§
showPicker(): void
[src]
§
stepDown(n?: number): void
[src]

Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value.

@param n

Value to decrement the value by.

§
stepUp(n?: number): void
[src]

Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value.

@param n

Value to increment the value by.