Guest User

Untitled

a guest
Jan 15th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. // get text of heading
  2. var plansBlockHeading = $('.first .sub .one h4').text();
  3.  
  4. // filter to last 2 chars
  5. var sup = plansBlockHeading.substr(plansBlockHeading.length-2);
  6.  
  7. // Wrap in a <sup></sup>
  8. $(sup).wrap("<sup />");
  9.  
  10. $('.first .sub .one h4').html(function(i, html) {
  11. // make sure there's no whitespace issues
  12. html = $.trim(html);
  13. return html.slice(0, -2) + "<sup>" + html.slice(-2) + "</sup>";
  14. });
  15.  
  16. var text = $('.first .sub .one h4').text();
  17. text = text.replace(/^(.*)(.{2,2})$/, "$1<sup>$2</sup>");
  18. $('.first .sub .one h4').html(text);
  19.  
  20. var elem = $('.first .sub .one h4'),
  21. text = elem.text(),
  22. html = text.slice(0,-2) + '<sup>' + text.slice(-2) + '</sup>';
  23. elem.html(html);​
Add Comment
Please, Sign In to add comment