Skip to content

Instantly share code, notes, and snippets.

@kennethreitz
Created March 23, 2010 14:17
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 kennethreitz/341211 to your computer and use it in GitHub Desktop.
Save kennethreitz/341211 to your computer and use it in GitHub Desktop.
jQuery script for sup-ing ordinals.
$.fn.orderedFigure = function() {
return this.each(function(){
var self = $(this);
var cont = self.html();
var cont2 = cont.replace(/(\d)(st|nd|rd|th)/g,'$1<sup>$2</sup>')
self.html(cont2);
})
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment