Search code examples
javascriptcssstrikethroughtext-decorationstext-styling

Clear the text style of the Element using Javascript


I need to clear the text decoration property of the element using java script.

Currently I am setting text decoration property of element to 'line-through'. In some point of time i need to undo the strike process.

How to reset the text decoration property using javascript?


Solution

  • Here's one way:

    HTML

    <p id="a">Some text</p>
    

    CSS

    p{text-decoration:line-through;}
    

    js

    var p = document.getElementById('a')
    p.style.textDecoration = 'none';
    

    http://jsfiddle.net/jasongennaro/nVeGB/