
- 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 title Property
The HTML DOM title property returns/sets a string corresponding to the value of the title attribute of a HTML element. The title value shows up when hovering over HTML element.
Following is the syntax −
Returning string value
ElementOfHTMLObject.title
Set title to a string value
ElementOfHTMLObject.title = string
Example
Let us see an example of HTML DOM title property −
<!DOCTYPE html> <html> <head> <title>HTML DOM title</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-title</legend> <input type="text" id="textSelect" title="" > <input type="button" onclick="getTitle()" value="Better define the above field"> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); var textSelect = document.getElementById("textSelect"); function getTitle() { if(textSelect.title === ''){ divDisplay.textContent = 'Details defined now! Please hover over field'; textSelect.title = 'Full Name Expected'; } } </script> </body> </html>
Output
Before clicking ‘Better define the above field’ button −
After clicking ‘Better define the above field’ button −
- Related Articles
- HTML DOM Title text Property
- HTML DOM Title Object
- HTML DOM tagName Property
- HTML DOM accessKey Property
- HTML DOM activeElement Property
- HTML DOM name Property
- HTML DOM nextElementSibling Property
- HTML DOM nextSibling Property
- HTML DOM nodeName Property
- HTML DOM nodeType Property
- HTML DOM nodeValue Property
- HTML DOM offsetHeight Property
- HTML DOM offsetLeft Property
- HTML DOM offsetParent Property
- HTML DOM offsetTop Property

Advertisements