stop one of the parent click events from firing
HI,
I am using a greybox on the following element:
<a href="<? echo $rctiGrayBox; ?>" class="greybox" widt="800" heigh="800" id="rctiGrayBox" title="RCTI">View RCTI</a>
This 'a' element is contained in TR which fires an event when ever we click 'View RCTI'.
I can stop that click event from firing by using stop开发者_JAVA百科Propagation()
but using this function also stops the greybox to work and instead of showing the data in greybox it shows the data on a new page.
Theoretically when i use stopPropagation()
on my 'a' tag it stops the all the events from firing. I need a way with which i can only stop the click event on but should not stop any event related to Greybox.
Please help!!
You are looking for event.preventDefault()
.
That will prevent the default behavior (guess what..), in this case will stop the anchor from linking.
Demo: http://www.jsfiddle.net/KDU48/
<a href="" onclick="return false;"></a>
this will stop the bubble up event in the browser. But bound eventhandlers will still work
精彩评论