How to create a strikethrough text using JavaScript?

JavascriptWeb DevelopmentFront End Technology

To create a strikethrough text with JavaScript, use the strike() method. This method causes a string to be displayed as struck-out text as if it were in a <strike> tag.

Example

You can try to run the following code to create a strikethrough text −

Live Demo

<html>
   <head>
      <title>JavaScript String strike() Method</title>
   </head>

   <body>
      <script>
         var str = new String("Demo Text");
         document.write(str.strike());
         alert(str.strike());
      </script>
   </body>
</html>
raja
Published on 18-Jan-2018 17:00:54
Advertisements