Easy Tutorial
❮ Obj Window Prop Style Fontsize ❯

Input Number required Attribute

Input Number Object

Example

Check if the number field is a required field before submitting the form:


Definition and Usage

The required attribute is used to set or return whether the number field is a required field in the form.

This attribute reflects the HTML required attribute.


Browser Support

All major browsers support the value attribute.

Note: Internet Explorer 9 and earlier versions do not support the <input> element with the type="number" attribute.


Syntax

Return the required attribute:

Set the required attribute:

Attribute Values

Value Description
true|false Describes whether the number field is a required part of the form before submission. true - The number field is a required part of the form<br>false - Default. The number field is an optional part of the form

Technical Details

| Return Value: | Boolean, returns true if the number field is a required part of the form, otherwise returns false. | | --- | --- |


More Examples

Example

Set the number field as a required part of the form:


Related Pages

HTML Reference: HTML <input> required Attribute


❮ Obj Window Prop Style Fontsize ❯