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/341209 to your computer and use it in GitHub Desktop.
Save kennethreitz/341209 to your computer and use it in GitHub Desktop.
jQuery: Find current path, and wrap in em's
$.fn.markCurrentLocation = function() {
var path = window.location.href
return this.each(function(){
var self = $(this);
var href = self.attr('href');
if(RegExp(href).test(path)){
self
.wrap('<em></em>')
}
})
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment