Let\'s say I have an element with an onclick event, and another element inside it, how do I disable the onclick for the child element?
Example:
Your handler (the "do something
"-part of the h3-tag) can check the tagName
of the originating element:
var origin = event.srcElement || event.target;
if (origin.tagName && origin.tagName.match(/h3/i)){
// do things
} else {return true;}
Now for the checkbox the click handler is triggered, but nothing will happen. Alternatively, you could supply the h3-tag with a unique id an check the id of the clicked element.