How to stop a javascript event from bubbling

February 25, 2010

Events on any html document bubble from child up to parent calling the handlers on each element until it reaches the Body.

In order to stop this from happening you can cancel the bubble by setting the cancelBubble property on the event to true

<INPUT TYPE=”TEXT” NAME=”TEXT1″ onclick=”alert(‘TEXT1′);event.cancelBubble=true;”>Name

Taken from http://webdevelopersjournal.com/articles/jsevents2/jsevents2.html

  • Share/Bookmark

Related posts:

  1. Can't Register Javascript for Invisible Control I was writing an ASP.Net Dialog Control and I overwrote...

Related posts brought to you by Yet Another Related Posts Plugin.

tags: ,
posted in Programming by admin

Follow comments via the RSS Feed | Leave a comment | Trackback URL

Leave Your Comment

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org