
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
How to set the decoration of a text with JavaScript?
Use the textDecoration property in JavaScript to decorate the text. You can underline a text using this property.
Example
You can try to run the following code to set the decoration of a text with JavaScript −
<!DOCTYPE html> <html> <body> <div id = "myText">This is demo text.</div><br> <button onclick = "display()">Set Text Decoration</button> <script> function display() { document.getElementById("myText").style.textDecoration = "underline"; } </script> </body> </html>
- Related Articles
- How to set the color of the text-decoration with JavaScript?
- How to set the type of line in a text-decoration with JavaScript?
- How to set the style of the line in a text decoration with JavaScript?
- Set the color of the text decoration in CSS
- Set the style of the text decoration in CSS
- How to set the capitalization of a text with JavaScript?
- Set the kind of decoration used on text in CSS
- How to set the shadow effect of a text with JavaScript?
- How to change the 'text-decoration' property with jQuery?
- How to set the horizontal alignment of text with JavaScript?
- How to set the font size of text with JavaScript?
- How to set text in tag with JavaScript?
- How to set the indentation of the first line of text with JavaScript?
- How to set the font family for text with JavaScript?
- How to set the space between characters in a text with JavaScript?

Advertisements