Skip to content

escapeString

Mike Byrne edited this page Mar 6, 2018 · 4 revisions

A17.Helpers.escapeString

  • v.1

description

Strips a string of HTML and returns a URI encoded string of the text content of a string, useful for social sharing links

requires

  • nothing

parameters

  • str - required - string

returns

  • URI encoded string

example usage:

<h1>Optical Cortex <a href="http://www.area17.com/">AREA 17</a></h1>
var title = document.getElementsByTagName("h1")[0].innerHTML;
var title_safe = A17.Helpers.escapeString(title); // "Optical%20Cortex%20AREA%2017"

Clone this wiki locally