HTML DOM Input Email required properties
Examples
View email field before submitting the form if required fields:
var x = document.getElementById("myEmail").required;
x The output is: true
try it"
Definition and Usage
required property sets or returns the email field in the form if a required field.
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, Safari browser.
Note: Internet Explorer 9 (and earlier versions of IE), or Safari browser does not support type = "email" in the HTML <input> elements.
grammar
Returns required attributes:
emailObject .required
Set the required properties:
emailObject .required=true|false
Property Value
值 | 描述 |
---|---|
true|false |
描述了 email 字段在表单提交前是否为必填部分。
|
technical details
return value: | Boolean value that, if the email fields are required parts of the form back to true, otherwise false. |
---|
More examples
Examples
Set email fields to the form required parts:
document.getElementById("myEmail").required = true;
try it"
Related Pages
HTML Reference Manual: HTML <the INPUT> required Attribute
Input Email Object