Javascript examples for DOM Event:onclick
Prevent and stop javascript onclick on child element via stopPropagation and cancelBubble=true
<html> <head></head> <body> <script type="text/javascript"> function manualToggle(val)/*from www .j av a 2 s.c o m*/ { console.log(val.id); } </script> <div id="test" onclick="manualToggle(this);"> <span>Allowed to click</span> <span onclick="event.cancelBubble=true;if (event.stopPropagation) event.stopPropagation();">Not allowed to click</span> <span>Allowed to click</span> </div> </body> </html>