Skip to content

Instantly share code, notes, and snippets.

@rseon
Created June 15, 2013 13:54
Show Gist options
  • Save rseon/5788222 to your computer and use it in GitHub Desktop.
Save rseon/5788222 to your computer and use it in GitHub Desktop.
How to find parent of an element when you can't do $('.element').parent().parent()... ?
$.extend($.fn, {
hasParent: function(p) {
return this.filter(function(){
return $(p).find(this).length;
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment