
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML DOM Input Email readOnly Property
The HTML DOM Input Email readOnly property sets/returns whether Input Email can be modified or not.
Syntax
Following is the syntax −
- Returning boolean value - true/false
inputEmailObject.readOnly
- Setting readOnlyto booleanValue
inputEmailObject.readOnly = booleanValue
Boolean Values
Here, “booleanValue” can be the following −
booleanValue | Details |
---|---|
true | It defines that the input email field is readOnly. |
false | It defines that the input email field is not readOnly and can be modified. |
Example
Let us see an example of Input Email readOnly property −
<!DOCTYPE html> <html> <head> <title>Input Email readOnly</title> <style> form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } </style> </head> <body> <form> <fieldset> <legend>Email-readOnly</legend> <label for="EmailSelect">Contact Us : <input type="email" id="EmailSelect" onclick="showErrorMsg()" value="infoHelpDesk@MNC.com" readOnly> </label> <input type="button" onclick="showMessage()" value="Copy Email Id"> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); var inputEmail = document.getElementById("EmailSelect"); divDisplay.textContent = 'Above email is read-only'; function showMessage() { inputEmail.select(); document.execCommand('copy'); divDisplay.textContent = 'Email Copied: '+inputEmail.value; } function showErrorMsg(){ divDisplay.textContent +=', This cannot be edited.' } </script> </body> </html>
Output
This will produce the following output −
Before clicking ‘Copy Email Id’ button −
Clicking ‘Contact Us’ email field −
Clicking ‘Copy Email Id’ −
- Related Articles
- HTML DOM Input URL readOnly Property
- HTML DOM Input Week readOnly Property
- HTML DOM Input Search readOnly property
- HTML DOM Input Text readOnly property
- HTML DOM Input Password readOnly property
- HTML DOM Input Month readOnly Property
- HTML DOM Input Number readOnly Property
- HTML DOM Input Date readOnly Property
- HTML DOM Input Datetime readOnly Property
- HTML DOM Input DatetimeLocal readOnly Property
- HTML DOM Input Time readOnly Property
- HTML DOM Input Email autocomplete Property
- HTML DOM Input Email autofocus Property
- HTML DOM Input Email defaultValue Property
- HTML DOM Input Email disabled Property

Advertisements