-
Notifications
You must be signed in to change notification settings - Fork 0
escapeString
Mike Byrne edited this page Jan 25, 2022
·
4 revisions
Strips a string of HTML and returns a URI encoded string of the text content of a string, useful for social sharing links
- nothing
- str - required - string to be stripped
- URI encoded string
<h1>Optical Cortex <a href="http://www.area17.com/">AREA 17</a></h1>
var title = document.getElementsByTagName("h1")[0].innerHTML;
var title_safe = escapeString(title); // "Optical%20Cortex%20AREA%2017"