Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with custom events in jQuery

 
Rob Dennett
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are triggering the event on an element that is not listening for it.

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic