A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/required below:

HTMLInputElement: required property - Web APIs

HTMLInputElement: required property

Baseline Widely available

The required property of the HTMLInputElement interface specifies that the user must fill in a value before submitting a form. It reflects the <input> element's required attribute.

While the HTML boolean required attribute is ignored if the type is hidden, range, color, submit, reset, button, and image, the required property is true for these input types if the attribute is present, false otherwise.

If a required input doesn't have a value, the ValidityState object's read-only valueMissing property will be true.

Value

A boolean.

Examples
const inputElement = document.getElementById("name");
console.log(inputElement.required);
inputElement.required = true;
Specifications Browser compatibility See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4