Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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
