File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Make it so: Java DB Connections & Transactions this week in the JDBC 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

Problem with custom events in jQuery

Rob Dennett
Ranch Hand

Joined: Dec 07, 2010
Posts: 81
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.


Eric Pascarello

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

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63552

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] [About Bear] [Books by Bear]
subject: Problem with custom events in jQuery
It's not a secret anymore!