for an action on a element, stop the action on his parent
Hello !
Is that possible when you click a child that the function on the parent don't run.
In these example, if I click on '
h2 > a', both elements triggers functions ('h2' & 'a')
What I wan't is that if I click on '
h2 > a', only the function on '
a' is launch,
not the function on the parent 'h2'.
(i just wan't the 'yo' ;-) )
-
$(document).ready(function(){
$('h2').click(function(){ alert('yeah') })
$('a').click(function(){ alert('yo') })
})
</script>
<h2>
yeah, <a href="#">yo</a>
</h2>
Thanks !