HTML DOM Input Text required properties
Examples
Check whether the text field before submitting filled:
var x = document.getElementById ( "myText") required.;
x The output is:
true
try it"
Definition and Usage
required property sets or returns whether the text field must be filled in before submitting.
This property reflects the HTML required attributes.
Browser Support
All major browsers support the required properties, in addition to Internet Explorer 9 and earlier versions of IE browser, Safari.
grammar
Returns required attributes:
textObject .required
Set the required properties:
textObject .required = true | false
Property Value
value | description |
---|---|
true | false | It specifies whether the text field is a required part of the form submission.
|
return value: | Boolean value, if a required part of the text field to the form submission returns true, false otherwise |
---|
More examples
Examples
Setting text field is a required part of the form submission:
. Document.getElementById ( "myText") required = true;
try it"
Related Pages
HTML Reference Manual: HTML <the INPUT> required Attribute
Input Text Object