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 JQuery .on(): Delegating to an enclosing DIV 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 "JQuery .on(): Delegating to an enclosing DIV" Watch "JQuery .on(): Delegating to an enclosing DIV" New topic
Author

JQuery .on(): Delegating to an enclosing DIV

K Mansoor
Ranch Hand

Joined: Jan 10, 2006
Posts: 52
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

Joined: Jan 10, 2002
Posts: 60785
    
  65

Should work. Please post an SSCCE (Short Self-Contained Correct Example)


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
K Mansoor
Ranch Hand

Joined: Jan 10, 2006
Posts: 52
As I started to construct the example. The code started to work. Browser caching? not sure.
Thank you.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

If only all problems resolved themselves so easily!
 
 
subject: JQuery .on(): Delegating to an enclosing DIV
 
Similar Threads
jQuery AJAX display issue
Is it possible to put a button inside autocomplete in jquery ui plugin?
Need help with Jquery
Jack Up Browser Viewport
Can you post data from textfields to a URL without having a <form>