I have index.php and use jQuery .load() to load content from load.php.
When I trigger an event on elements that are in the index.php, the event fires. On the same elements, when loaded with .load() into index.php the events do not fire!?
Why? Am I doing sth wrong?
If I preview the page with e.g. FireBug, the #id of the element is exactly like it should be, but not even a function like this works:
$('#clickme').click(function() {
alert('hello');
});
The same function works, if the element is placed in the index.php and not loaded with .load(). Any ideas??
Thank you very much in advance!
The
clickevent binder does not bind to any elements created after execution. You can add aclicklistener immediately following the.load()method, or you can use something likeliveordelegateto bind to element patterns in the DOM.