I am trying to add <sup></sup>
tags around every ™, ®, © in my page.
I found this question: CSS superscript registration trademark which helped get me started.
The script works in the sense that the tags are being placed in the proper locations, but it is adding two <sup></sup>
tags around each instead of just one.
Here is my JS adding the tags:
jQuery("body").html(
jQuery("body").html().replace(/®/gi, '<sup>®</sup>').replace(/?/gi, '<sup>®</sup>').
replace(/™/gi, '<sup>™</sup>').
replace(/?/gi, '<sup>™</sup>').
replace(/©/gi, '<sup>©</sup>').
replace(/?/gi, '<sup>©</sup>')
);
How can I make sure the tags are only added once per symbol? A conditional of some sort maybe?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…