JavaScript strike() Method | Rookie Tutorial
Rookie Tutorial -- Learn not only technology, but also dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
JavaScript Reference Manual
JavaScript Objects
JavaScript Array ObjectJavaScript Boolean ObjectJavaScript Date ObjectJavaScript Math ObjectJavaScript Number ObjectJavaScript String ObjectJavaScript RegExp ObjectJavaScript Global Properties/FunctionsJavaScript OperatorsJavaScript Error
Browser Objects
Window ObjectNavigator ObjectScreen ObjectHistory ObjectLocation ObjectStorage Object
DOM Objects
HTML DOM Document ObjectHTML DOM Element ObjectHTML DOM Attribute ObjectHTML DOM Event ObjectHTML DOM Console ObjectCSSStyleDeclaration ObjectDOM HTMLCollection
HTML Objects
<a> <area> <audio> <base> <blockquote> <body> <button> <canvas> <col> <colgroup> <datalist> <del> <details> <dialog> <embed> <fieldset> <form> <iframe> <frameset > <img> <ins> <input> - button <input> - checkbox <input> - file <input> - hidden <input> - password <input> - radio <input> - reset <input> - submit <input> - text <keygen> <label> <legend> <li> <link> <map> <menu> <menuitem> <meta> <meter> <object> <ol> <optgroup> <option> <output> <param> <progress> <q> <script> <select> <source> <style> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <video>
JavaScript strike() Method
Definition and Usage
The strike() method is used to display a string as strikethrough text.
This method wraps the string in a <strike> tag: "<strike>" + string + "</strike>"
Note: The <strike> tag is not supported in HTML5. Use CSS instead.
Syntax
string.strike()
Return Value
| Type | Description |
|---|---|
| String | Returns a string wrapped in <strike> tags |
Browser Support
| Method | Chrome | Edge | Firefox | IE | Opera | Safari |
|---|---|---|---|---|---|---|
| strike() | Yes | Yes | Yes | Yes | Yes | Yes |
Example
Example 1
Display a string as strikethrough text:
var str = "Hello World!"; var res = str.strike();
The result of res:
<strike>Hello World!</strike>
Example 2
All "BIG" browsers support this method:
var str = "Hello World!"; document.write(str.strike());
Output:
Hello World!
Related Pages
JavaScript String Object Reference Manual: JavaScript String Object
HTML <strike> Tag: HTML <strike> Tag
HTML DOM Reference Manual: HTML DOM Document Object
JavaScript Reference Manual: JavaScript and HTML DOM Reference Manual
Previous: big() Method Next: small() Method
Points Note: Rookie Tutorial provides programming technology tutorials, and is committed to popularizing various programming technology knowledge. The Rookie Tutorial has been adhering to the concept of "Learn not only technology, but also dreams!"
YouTip