Javascript DOM CSS Style textDecoration Property get

Introduction

Return the text decoration of a <p> element:

alert(document.getElementById("myP").style.textDecoration);

View in separate window

<!DOCTYPE html>
<html>
<body>

<p id="myP" style="text-decoration:line-through;">This is an example paragraph.</p>

<button type="button" onclick="myFunction()">Return text decoration of p</button>

<p id="demo"></p>
<script>
function myFunction() {/*  w w w. j a  v  a  2 s . c om*/
  document.getElementById("demo").innerHTML = document.getElementById("myP").style.textDecoration;
}
</script>

</body>
</html>



PreviousNext

Related