Issue
I have this a_tag element:
<a href="Mywebsite/test/cart/" class="added_to_cart" title="View cart">View cart</a>
which is bound to different click events by outer plugins used on my website, I tried to remove all the other click events using this,
$('.added_to_cart').click(function() { return false; });
Which is working fine but it is also disabling the href link redirection.
Is there a way to remove all the click events and keep the href link redirection ??
Solution
return false
in event is almost the same as ev.preventDefault()
that is mean that all default events will not be fired.
For prevent other events, but not default behaviour (redirect by link), you need to stop propagation of event:
$('.added_to_cart').click(function(ev) { ev.stopImmediatePropagation(); });
Answered By - some name
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.