jQuery Superscript all registered marks

This small jQuery snippet will wrap all registered marks in a superscript element. This is handy when you have many static HTML files and are unable to do it via database, or your site runs on a CMS and you need to keep registered marks superscripted, regardless of how it's entered by the CMS user.
var re = new RegExp(String.fromCharCode(174), 'g');
var html;
$('h1,h2,#any-other-tag-that-might-have-one').each(function() {
	html = $(this).html();
	if (html) {
		html = html.replace(re, '<sup>®</sup>').replace(/®/gi, '<sup>®</sup>');
Posted by
Snippet Viewed 8663 times.

Share your jQuery code snippets:

  • Get some recognition & a link back to your site.
  • Create your own code library.
  • Help your fellow developers, as they have helped you.


Submit | Browse

Most Recent jquery snippets

Most Viewed