Find and Replace


/ Published in: jQuery
Save to your folder(s)

Finds word "AGM" and replace with acronym or abbr title.


Copy this code and paste it in your HTML
  1. //Cross-browser CSS
  2. abbr, acronym, .help {
  3. border-bottom-style:dotted;
  4. border-bottom-width:1px;
  5. border-bottom-color:#000;
  6. cursor:help;
  7. display:inline-block;
  8. }
  9.  
  10. //acronym
  11. jQuery("p.att").each(function() {
  12. jQuery(this).html(jQuery(this).html().replace('AGM', '<acronym title="Absorbed Glass Mat">AGM</acronym>'));
  13. });
  14.  
  15. //abbreviation
  16. jQuery("p.att").each(function() {
  17. jQuery(this).html(jQuery(this).html().replace('AGM', '<abbr title="Absorbed Glass Mat">AGM</abbr>'));
  18. });
  19.  
  20. //help class
  21. jQuery("p.att").each(function() {
  22. jQuery(this).html(jQuery(this).html().replace('AGM', '<span class="help" title="Absorbed Glass Mat">AGM</span>'));
  23. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.