wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Problem with custom events in jQuery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem with custom events in jQuery" Watch "Problem with custom events in jQuery" New topic
Author

Problem with custom events in jQuery

Rob Dennett
Ranch Hand

Joined: Dec 07, 2010
Posts: 79
I created the following test app to debug some jQuery code I am developing. When I click on the button, I get the first debug message ("ever here"), but not the second ("foo"). I can't figure out what I am doing wrong here. Please advise.

Thanks,
Rob

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You are triggering the event on an element that is not listening for it.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60738
    
  65

Remember that events, even custom events, bubble up the DOM tree. So you must trigger events on the listening element or one of its descendants.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with custom events in jQuery
 
Similar Threads
stopping event propagation best practice (jQuery)
jQuery question- jQuery attribute in IE?
dojo and javascript DOM issue
jQuery.getJSON callback not executing
Not able to hide a sentence using jquery