I have a very basic HTML layout as follows;
<div class="module">
<div class="module-header">
<h2>Heading</h2>
<a title="a" href="/" class="btn">Link</a>
</div>
<div class="module-body">
<p>Boy content here.</p>
</div>
</div>
I have some jQuery that toggles the module-body div when a user clicks in the module-header div as follows:
$('body').on("click", '.module-header', function(event) {
$('.module-body', $(this).parent()).slideToggle(300);
});
The problem I have is that when a user clicks on the link within module-header, the toggle animation runs for a fraction of a second before the link fires. Is there a selector, or another method I can use so that the onClick event doesn't fire if the user clicks the link?