HtmlInputElement Class

https://html.spec.whatwg.org/multipage/input.html#htmlinputelement

public sealed class HtmlInputElement : HtmlElement
Inheritance
HtmlElement HtmlInputElement

Properties

NameDescription
AcceptGets or sets the value of the accept content attribute.
AlignGets or sets the value of the align content attribute.
AlphaGets or sets a value indicating whether the element has the alpha content attribute.
AltGets or sets the value of the alt content attribute.
AutocompleteGets or sets the value of the autocomplete content attribute.
Checkedhttps://html.spec.whatwg.org/multipage/input.html#dom-input-checked
ColorSpaceGets or sets the value of the colorspace content attribute, limited to the known values (the canonical keyword, or the default value).
DefaultCheckedGets or sets a value indicating whether the element has the checked content attribute.
DefaultValueGets or sets the value of the value content attribute.
DirNameGets or sets the value of the dirname content attribute.
DisabledGets or sets a value indicating whether the element has the disabled content attribute.
Fileshttps://html.spec.whatwg.org/multipage/input.html#dom-input-files
FormGets the form owner of the element, or null when it has none.
FormActionGets or sets the value of the formaction content attribute.
FormEnctypeGets or sets the value of the formenctype content attribute, limited to the known values (the canonical keyword, or the default value).
FormMethodGets or sets the value of the formmethod content attribute, limited to the known values (the canonical keyword, or the default value).
FormNoValidateGets or sets a value indicating whether the element has the formnovalidate content attribute.
FormTargetGets or sets the value of the formtarget content attribute.
HeightGets or sets the value of the height content attribute.
HspaceGets or sets the value of the hspace content attribute.
IndeterminateGets or sets a value indicating whether the checkbox is in the indeterminate state.
LabelsGets the label elements associated with the element.
Listhttps://html.spec.whatwg.org/multipage/input.html#dom-input-list
MaxGets or sets the value of the max content attribute.
MaxLengthGets or sets the value of the maxlength content attribute.
MinGets or sets the value of the min content attribute.
MinLengthGets or sets the value of the minlength content attribute.
MultipleGets or sets a value indicating whether the element has the multiple content attribute.
NameGets or sets the value of the name content attribute.
PatternGets or sets the value of the pattern content attribute.
PlaceholderGets or sets the value of the placeholder content attribute.
PopoverTargetActionGets or sets the value of the popovertargetaction content attribute, limited to the known values (the canonical keyword, or the default value).
PopoverTargetElementGets or sets the element whose ID is the value of the popovertarget content attribute.
ReadOnlyGets or sets a value indicating whether the element has the readonly content attribute.
RequiredGets or sets a value indicating whether the element has the required content attribute.
SelectionDirectionGets or sets the direction of the text selection (forward, backward or none), or null when the selection does not apply to the input type.
SelectionEndGets or sets the index of the end of the text selection, or null when the selection does not apply to the input type.
SelectionStartGets or sets the index of the start of the text selection, or null when the selection does not apply to the input type.
SizeGets or sets the value of the size content attribute.
SrcGets or sets the src content attribute, as a URL resolved against the base URL of the document.
StepGets or sets the value of the step content attribute.
TypeGets or sets the value of the type content attribute, limited to the known values (the canonical keyword, or the default value).
UseMapGets or sets the value of the usemap content attribute.
ValidationMessageGets the error message that would be shown to the user if the element is invalid, or an empty string.
ValidityGets the ValidityState object that describes the validity of the element.
Valuehttps://html.spec.whatwg.org/multipage/input.html#dom-input-value
ValueAsDatehttps://html.spec.whatwg.org/multipage/input.html#dom-input-valueasdate
ValueAsNumberhttps://html.spec.whatwg.org/multipage/input.html#dom-input-valueasnumber
VspaceGets or sets the value of the vspace content attribute.
WidthGets or sets the value of the width content attribute.
WillValidateGets a value indicating whether the element is a candidate for constraint validation.

Gets or sets the value of the accept content attribute.

public string Accept { get; set; }

Gets or sets the value of the align content attribute.

public string Align { get; set; }

Gets or sets a value indicating whether the element has the alpha content attribute.

public bool Alpha { get; set; }

Gets or sets the value of the alt content attribute.

public string Alt { get; set; }

Autocomplete

HtmlElements.g.cs

Gets or sets the value of the autocomplete content attribute.

public string Autocomplete { get; set; }

https://html.spec.whatwg.org/multipage/input.html#dom-input-checked

public bool Checked { get; set; }

Gets or sets the value of the colorspace content attribute, limited to the known values (the canonical keyword, or the default value).

public string ColorSpace { get; set; }

DefaultChecked

HtmlElements.g.cs

Gets or sets a value indicating whether the element has the checked content attribute.

public bool DefaultChecked { get; set; }

DefaultValue

HtmlElements.g.cs

Gets or sets the value of the value content attribute.

public string DefaultValue { get; set; }

Gets or sets the value of the dirname content attribute.

public string DirName { get; set; }

Gets or sets a value indicating whether the element has the disabled content attribute.

public bool Disabled { get; set; }

https://html.spec.whatwg.org/multipage/input.html#dom-input-files

public FileList? Files { get; set; }

Gets the form owner of the element, or null when it has none.

public HtmlFormElement? Form { get; }

Gets or sets the value of the formaction content attribute.

public string FormAction { get; set; }

Gets or sets the value of the formenctype content attribute, limited to the known values (the canonical keyword, or the default value).

public string FormEnctype { get; set; }

Gets or sets the value of the formmethod content attribute, limited to the known values (the canonical keyword, or the default value).

public string FormMethod { get; set; }

FormNoValidate

HtmlElements.g.cs

Gets or sets a value indicating whether the element has the formnovalidate content attribute.

public bool FormNoValidate { get; set; }

Gets or sets the value of the formtarget content attribute.

public string FormTarget { get; set; }

Gets or sets the value of the height content attribute.

public uint Height { get; set; }

Gets or sets the value of the hspace content attribute.

public uint Hspace { get; set; }

Indeterminate

HtmlInputElement.cs

Gets or sets a value indicating whether the checkbox is in the indeterminate state.

public bool Indeterminate { get; set; }

Gets the label elements associated with the element.

public NodeList? Labels { get; }

https://html.spec.whatwg.org/multipage/input.html#dom-input-list

public HtmlDataListElement? List { get; }

Gets or sets the value of the max content attribute.

public string Max { get; set; }

Gets or sets the value of the maxlength content attribute.

public int MaxLength { get; set; }

Gets or sets the value of the min content attribute.

public string Min { get; set; }

Gets or sets the value of the minlength content attribute.

public int MinLength { get; set; }

Gets or sets a value indicating whether the element has the multiple content attribute.

public bool Multiple { get; set; }

Gets or sets the value of the name content attribute.

public string Name { get; set; }

Gets or sets the value of the pattern content attribute.

public string Pattern { get; set; }

Gets or sets the value of the placeholder content attribute.

public string Placeholder { get; set; }

PopoverTargetAction

HtmlElements.g.cs

Gets or sets the value of the popovertargetaction content attribute, limited to the known values (the canonical keyword, or the default value).

public string PopoverTargetAction { get; set; }

PopoverTargetElement

HtmlElements.g.cs

Gets or sets the element whose ID is the value of the popovertarget content attribute.

public Element? PopoverTargetElement { get; set; }

Gets or sets a value indicating whether the element has the readonly content attribute.

public bool ReadOnly { get; set; }

Gets or sets a value indicating whether the element has the required content attribute.

public bool Required { get; set; }

SelectionDirection

HtmlInputElement.cs

Gets or sets the direction of the text selection (forward, backward or none), or null when the selection does not apply to the input type.

public string? SelectionDirection { get; set; }

Gets or sets the index of the end of the text selection, or null when the selection does not apply to the input type.

public uint? SelectionEnd { get; set; }

SelectionStart

HtmlInputElement.cs

Gets or sets the index of the start of the text selection, or null when the selection does not apply to the input type.

public uint? SelectionStart { get; set; }

Gets or sets the value of the size content attribute.

public uint Size { get; set; }

Gets or sets the src content attribute, as a URL resolved against the base URL of the document.

public string Src { get; set; }

Gets or sets the value of the step content attribute.

public string Step { get; set; }

Gets or sets the value of the type content attribute, limited to the known values (the canonical keyword, or the default value).

public string Type { get; set; }

Gets or sets the value of the usemap content attribute.

public string UseMap { get; set; }

ValidationMessage

FormControlMembers.cs

Gets the error message that would be shown to the user if the element is invalid, or an empty string.

public string ValidationMessage { get; }

Gets the ValidityState object that describes the validity of the element.

public ValidityState Validity { get; }

https://html.spec.whatwg.org/multipage/input.html#dom-input-value

public string Value { get; set; }

https://html.spec.whatwg.org/multipage/input.html#dom-input-valueasdate

public DateTime? ValueAsDate { get; set; }

ValueAsNumber

HtmlInputElement.cs

https://html.spec.whatwg.org/multipage/input.html#dom-input-valueasnumber

public double ValueAsNumber { get; set; }

Gets or sets the value of the vspace content attribute.

public uint Vspace { get; set; }

Gets or sets the value of the width content attribute.

public uint Width { get; set; }

Gets a value indicating whether the element is a candidate for constraint validation.

public bool WillValidate { get; }

Methods

NameDescription
CheckValidity()Returns whether the element satisfies its constraints, firing an invalid event when it does not.
ReportValidity()Checks whether the element satisfies its constraints, firing an invalid event when it does not.
Select()https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-textarea/input-select
SetCustomValidity(string)Sets the custom validity error message of the element; an empty string clears the custom error.
SetRangeText(string)Replaces the selected text with the given text.
SetRangeText(string, uint, uint, string)Replaces the text between the start and end indexes with the given text and updates the selection according to the selection mode.
SetSelectionRange(uint, uint, string?)Selects the text between the start and end indexes, with the given direction.
ShowPicker()https://html.spec.whatwg.org/multipage/input.html#dom-input-showpicker
StepDown(int)Decreases the value by the given number of steps (one by default) of the step attribute.
StepUp(int)Increases the value by the given number of steps (one by default) of the step attribute.

CheckValidity()

FormControlMembers.cs

Returns whether the element satisfies its constraints, firing an invalid event when it does not.

public bool CheckValidity()

ReportValidity()

FormControlMembers.cs

Checks whether the element satisfies its constraints, firing an invalid event when it does not.

public bool ReportValidity()

https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-textarea/input-select

public void Select()

SetCustomValidity(string)

FormControlMembers.cs

Sets the custom validity error message of the element; an empty string clears the custom error.

public void SetCustomValidity(string error)

SetRangeText overloads

SetRangeText(string)

HtmlInputElement.cs

Replaces the selected text with the given text.

public void SetRangeText(string replacement)

SetRangeText(string, uint, uint, string)

HtmlInputElement.cs

Replaces the text between the start and end indexes with the given text and updates the selection according to the selection mode.

public void SetRangeText(string replacement, uint start, uint end, string selectionMode = "preserve")

SetSelectionRange(uint, uint, string?)

HtmlInputElement.cs

Selects the text between the start and end indexes, with the given direction.

public void SetSelectionRange(uint start, uint end, string? direction = null)

https://html.spec.whatwg.org/multipage/input.html#dom-input-showpicker

public void ShowPicker()

StepDown(int)

HtmlInputElement.cs

Decreases the value by the given number of steps (one by default) of the step attribute.

public void StepDown(int n = 1)

Increases the value by the given number of steps (one by default) of the step attribute.

public void StepUp(int n = 1)