SO Question
http://stackoverflow.com/q/5549840/435873 Handling bubbling events
by leomwa
HTML
<div id="feature" rel="urlnumberone">
Click on
<a href="javascript:topicChange();" class="insideLink">Link</a>
to call JS 'topicChange'.
</div>
<br />
<p>Link to question on StackOverflow: http://stackoverflow.com/q/5549840/435873</p>
JavaScript
function topicChange() {
alert('Message from Link: After the div mouse event, I can execute');
return false;
}
$('div#feature').click(function(evnt) {
var $originatingTarget = $(evnt.target);
if ($originatingTarget && $originatingTarget.is('.insideLink')) {
alert('Message from Div: Ahh! You clicked on Link...');
evnt.stopPropagation(); // Allows other handlers on the event.target to be executed.
}
});