• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JQuery .on(): Delegating to an enclosing DIV

 
K Mansoor
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can a <DIV> element be used to delegate events bound to elements which will come into existence in the future?



Can I do something like this? please keep in mind at the execution of this code, the form and it's children (the button with id='some-button-id') does not exist.


This is not working for me, however, the following does work:


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should work. Please post an SSCCE (Short Self-Contained Correct Example)
 
K Mansoor
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I started to construct the example. The code started to work. Browser caching? not sure.
Thank you.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If only all problems resolved themselves so easily!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic