Table of Contents

Interface IHtmlInputElement

Namespace
AngleSharp.Html.Dom
Assembly
AngleSharp.dll

Represents the input HTML element.

[DomName("HTMLInputElement")]
public interface IHtmlInputElement : IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IGlobalEventHandlers, IValidation
Inherited Members
Extension Methods

Properties

Accept

Gets or sets the accept HTML attribute, containing comma-separated list of file types accepted by the server when type is file.

[DomName("accept")]
string? Accept { get; set; }

Property Value

string

AlternativeText

Gets or sets the alternative text.

[DomName("alt")]
string? AlternativeText { get; set; }

Property Value

string

Autocomplete

Gets or sets the autocomplete HTML attribute, indicating whether the value of the control can be automatically completed by the browser. Ignored if the value of the type attribute is hidden, checkbox, radio, file, or a button type (button, submit, reset, image).

[DomName("autocomplete")]
string? Autocomplete { get; set; }

Property Value

string

Autofocus

Gets or sets the autofocus HTML attribute, which indicates whether the control should have input focus when the page loads.

[DomName("autofocus")]
bool Autofocus { get; set; }

Property Value

bool

DefaultValue

Gets or sets the default value.

[DomName("defaultValue")]
string DefaultValue { get; set; }

Property Value

string

DirectionName

Gets or sets the directionality of the form element.

[DomName("dirName")]
string? DirectionName { get; set; }

Property Value

string

DisplayHeight

Gets or sets the display height of the input element.

[DomName("height")]
int DisplayHeight { get; set; }

Property Value

int

DisplayWidth

Gets or sets the display width of the input element.

[DomName("width")]
int DisplayWidth { get; set; }

Property Value

int

Files

Gets a list of selected files.

[DomName("files")]
IFileList? Files { get; }

Property Value

IFileList

Form

Gets the associated HTML form element.

[DomName("form")]
IHtmlFormElement? Form { get; }

Property Value

IHtmlFormElement

FormAction

Gets or sets the URI of a resource that processes information submitted by the button. If specified, this attribute overrides the action attribute of the form element that owns this element.

[DomName("formAction")]
string? FormAction { get; set; }

Property Value

string

FormEncType

Gets or sets the type of content that is used to submit the form to the server. If specified, this attribute overrides the enctype attribute of the form element that owns this element.

[DomName("formEncType")]
string FormEncType { get; set; }

Property Value

string

FormMethod

Gets or sets 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.

[DomName("formMethod")]
string FormMethod { get; set; }

Property Value

string

FormNoValidate

Gets or sets that the form is not to be validated when it is submitted. If specified, this attribute overrides the enctype attribute of the form element that owns this element.

[DomName("formNoValidate")]
bool FormNoValidate { get; set; }

Property Value

bool

FormTarget

Gets or sets 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.

[DomName("formTarget")]
string? FormTarget { get; set; }

Property Value

string

HasValue

Gets if the input field has a value (via attribute or directly).

bool HasValue { get; }

Property Value

bool

IsChecked

Gets or sets if the input element is checked or not.

[DomName("checked")]
bool IsChecked { get; set; }

Property Value

bool

IsDefaultChecked

Gets or sets

[DomName("defaultChecked")]
bool IsDefaultChecked { get; set; }

Property Value

bool

IsDisabled

Gets or sets if the textarea is enabled or disabled.

[DomName("disabled")]
bool IsDisabled { get; set; }

Property Value

bool

IsIndeterminate

Gets or sets if the state if indeterminate.

[DomName("indeterminate")]
bool IsIndeterminate { get; set; }

Property Value

bool

IsMultiple

Gets or sets the multiple HTML attribute, whichindicates whether multiple items can be selected.

[DomName("multiple")]
bool IsMultiple { get; set; }

Property Value

bool

IsReadOnly

Gets or sets if the field is read-only.

[DomName("readOnly")]
bool IsReadOnly { get; set; }

Property Value

bool

IsRequired

Gets or sets if the field is required.

[DomName("required")]
bool IsRequired { get; set; }

Property Value

bool

Labels

Gets the list of assigned labels.

[DomName("labels")]
INodeList Labels { get; }

Property Value

INodeList

List

Gets the datalist element in the same document. Only options that are valid values for this input element will be displayed. This attribute is ignored when the type attribute's value is hidden, checkbox, radio, file, or a button type.

[DomName("list")]
IHtmlDataListElement? List { get; }

Property Value

IHtmlDataListElement

MaxLength

Gets or sets the maxlength HTML attribute, indicating the maximum number of characters the user can enter. This constraint is evaluated only when the value changes.

[DomName("maxLength")]
int MaxLength { get; set; }

Property Value

int

Maximum

Gets or sets 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.

[DomName("max")]
string? Maximum { get; set; }

Property Value

string

MinLength

Gets or sets the minlength HTML attribute, indicating the minimum number of characters the user can enter. This constraint is evaluated only when the value changes.

[DomName("minLength")]
int MinLength { get; set; }

Property Value

int

Minimum

Gets or sets 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.

[DomName("min")]
string? Minimum { get; set; }

Property Value

string

Name

Gets or sets the name of the element.

[DomName("name")]
string? Name { get; set; }

Property Value

string

Pattern

Gets or sets the 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. This attribute applies when the value of the type attribute is text, search, tel, url or email; otherwise it is ignored.

[DomName("pattern")]
string? Pattern { get; set; }

Property Value

string

Placeholder

Gets or sets the placeholder HTML attribute, containing a hint to the user about what to enter in the control.

[DomName("placeholder")]
string? Placeholder { get; set; }

Property Value

string

SelectionDirection

Gets the direction in which selection occurred. This is "forward" if selection was performed in the start-to-end direction of the current locale, or "backward" for the opposite direction.

[DomName("selectionDirection")]
string? SelectionDirection { get; }

Property Value

string

SelectionEnd

Gets or sets the index of the end of selected text. If no text is selected, contains the index of the character that follows the input cursor. On being set, the control behaves as if setSelectionRange() had been called with this as the second argument, and selectionStart as the first argument.

[DomName("selectionEnd")]
int SelectionEnd { get; set; }

Property Value

int

SelectionStart

Gets or sets the index of the beginning of selected text. If no text is selected, contains the index of the character that follows the input cursor. On being set, the control behaves as if setSelectionRange() had been called with this as the first argument, and selectionEnd as the second argument.

[DomName("selectionStart")]
int SelectionStart { get; set; }

Property Value

int

Size

Gets or sets the display size of the element.

[DomName("size")]
int Size { get; set; }

Property Value

int

Source

Gets or sets the image source.

[DomName("src")]
string? Source { get; set; }

Property Value

string

Step

Gets or sets 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. 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.

[DomName("step")]
string? Step { get; set; }

Property Value

string

Type

Gets or sets the type of input control.

[DomName("type")]
string Type { get; set; }

Property Value

string

Value

Gets or sets the value.

[DomName("value")]
string Value { get; set; }

Property Value

string

ValueAsDate

Gets or sets the value of the element, interpreted as a date, or null if conversion is not possible.

[DomName("valueAsDate")]
DateTime? ValueAsDate { get; set; }

Property Value

DateTime?

ValueAsNumber

Gets or sets the value of the element, interpreted as one of the following in order: 1.) Time value 2.) Number 3.) otherwise NaN.

[DomName("valueAsNumber")]
double ValueAsNumber { get; set; }

Property Value

double

Methods

Select(int, int, string?)

Selects a range of text, and sets selectionStart and selectionEnd. If either argument is greater than the length of the value, it is treated as pointing to the end of the value. If end is less than start, then both are treated as the value of end.

[DomName("setSelectionRange")]
void Select(int selectionStart, int selectionEnd, string? selectionDirection = null)

Parameters

selectionStart int

The start of the selection.

selectionEnd int

The end of the selection.

selectionDirection string

Optional: The direction of the selection.

SelectAll()

Selects the contents of the textarea.

[DomName("select")]
void SelectAll()

StepDown(int)

Decrements the value by (step * n), where n defaults to 1 if not specified.

[DomName("stepDown")]
void StepDown(int n = 1)

Parameters

n int

Optional: The number of steps to take.

StepUp(int)

Increments the value by (step * n), where n defaults to 1 if not specified.

[DomName("stepUp")]
void StepUp(int n = 1)

Parameters

n int

Optional: The number of steps to take.