Skip to content

Instantly share code, notes, and snippets.

@clarknelson
Created October 30, 2017 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clarknelson/417c011325a5c155aa765cb216d5dbd4 to your computer and use it in GitHub Desktop.
Save clarknelson/417c011325a5c155aa765cb216d5dbd4 to your computer and use it in GitHub Desktop.
// store the element for later
// element === '<div>$9.99 USD/month</div>'
var $el = $(element);
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
// http://regexr.com/3h2rl
var newText = $el.text().replace('/\/month/', '<span>/month</span>');
// set the element to use the next text
$el.text(newText);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment