
- 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 Mark Object
The HTML DOM Mark Object in HTML represents the <mark> element.
Syntax
Following is the syntax −
Creating a <mark> element
var markObject = document.createElement(“MARK”)
Example
Let us see an example for HTML DOM Mark element −
<!DOCTYPE html> <html> <head> <title>HTML DOM Mark</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>HTML-DOM-Mark</legend> <label>Full Name: <input type="text" id="textSelect" autocomplete="off"> <input type="button" value="Submit" onclick="createMark()"> </label> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); var textSelect = document.getElementById("textSelect"); function createMark() { if(textSelect.value === ''){ var mark = document.createElement('MARK'); var textInput = document.createTextNode('Name Required'); mark.appendChild(textInput); divDisplay.insertAdjacentElement("afterbegin", mark); } } </script> </body> </html>
Output
This will produce the following output −
Before clicking ‘Submit’ button −
After clicking ‘Submit’ button −
- Related Articles
- HTML DOM HTML Object
- HTML DOM Object Object
- HTML DOM Ins Object
- HTML DOM HR Object
- HTML DOM Variable Object
- HTML DOM aside Object
- HTML DOM Abbreviation Object
- HTML DOM Address Object
- HTML DOM Meter Object
- HTML DOM MouseEvent Object
- HTML DOM Nav Object
- HTML DOM Ol Object
- HTML DOM Time Object
- HTML DOM Title Object
- HTML DOM TouchEvent Object

Advertisements