This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 60783
    
  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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with custom events in jQuery
 
Similar Threads
jQuery.getJSON callback not executing
stopping event propagation best practice (jQuery)
jQuery question- jQuery attribute in IE?
dojo and javascript DOM issue
Not able to hide a sentence using jquery