I have this code:
var originalBorder = container.css("border");
container.hover(function(event) {
event.stopPropagation();
$(this).css("border", "1px solid "+options.color);
},function(){
$(this).css("border", originalBorder);
});
Which I am using to add a border to the currently hovered element. However for example if a span is inside a div they are both getting borders. I only want to target the span. I thought that adding event.stopPropagation() would do the trick (this is what I would do in Flex, which is what I am more used to) but I guess this is a live event which I dont even understand what that means. So basically how can target the youngest element without triggering the parents?
Thanks!!
update
Some more info. I am trying to add this effect to every element. so I am actually added the effect to the div and the span but I only want the div to be triggered when it is the youngest element that is hovered. And when a younger element is hovered like a span within a div then only the span is triggered. The code above is a plugin and I am calling it like this: #("*").doBorders()