Skip to content

Instantly share code, notes, and snippets.

@andredublin
Created September 8, 2011 18:37
Show Gist options
  • Save andredublin/1204233 to your computer and use it in GitHub Desktop.
Save andredublin/1204233 to your computer and use it in GitHub Desktop.
Find current item event out of a collection of objects
var objs = document.getElementsByTagName('li');
$(objs).hover(function(event) {
if (this == event.currentTarget) {
console.log('yep');
} else {
console.log('nope');
}
});
$(objs).click(function(event) {
if (this == event.currentTarget) {
console.log('yep');
} else {
console.log('nope');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment