I\'d like to check ancestry using two jQuery objects. They don\'t have IDs, and are only going to be available as jQuery objects (or DOM nodes if you called get()
get()
You can use the index() method to check if an element exists in a list, so would the following work?
var someDiv = $('#div'); $('a').click(function() { if ($(this).parents().index(someDiv) >= 0) { alert('boo'); } }
From #index reference.