 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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>Advertisements
 