deep inside a document - I
would like to only add the class "selected" to that
tag, not the
<div>, <body> and <html> tags surrounding it.
So far my thinking has been to use something like this:
$(function() {
$("*").hover(
function(){
$(this).addClass('selected');
},
function(){
$(this).removeClass('selected');
}
);
}
Which adds the "selected" class to any element I hover over fine. It
also removes it.
The problem is the hover is firing all the way up the chain and
hitting all elements from the lowest to the highest so I've got a ton
of ugly selected elements when I really just wanted the lowest one...
Is there any way I can restrict it?
Thanks,
John