stripTags

stripTags() -> string

Strips a string of any HTML tag.

Watch out for <script> tags in your string, as String#stripTags will not remove their content. Use String#stripScripts to do so.

Examples


'a <a href="#">link</a>'.stripTags();
// -> 'a link'

'a <a href="#">link</a><script>alert("hello world!")</script>'.stripTags();
// -> 'a linkalert("hello world!")'

'a <a href="#">link</a><script>alert("hello world!")</script>'.stripScripts().stripTags();
// -> 'a link'