JavaScript > Methods

Strikethrough style in JavaScript

How to apply strikethrough style to the text in JavaScript?


In case we want to apply the strikethrough style to the text in the html page, we can use this approach.

<script>
        document.write("This is Striked text ");
        document.write(" This is Striked text".strike());
</script>

In the above code snippet, we have written “This is Striked text” in both document.write lines but in the 2nd statement we have called the strike() method using the text that makes this text in strikethrough style as you can see in the below picture.

OUTPUT

 Views: 760 | Post Order: 47



Write for us