mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
DOCS: jQuery delegation in Admin interface
This commit is contained in:
parent
587b065fc2
commit
cacbbd75bc
@ -250,7 +250,7 @@ Ready](http://docs.jquery.com/How_jQuery_Works#Launching_Code_on_Document_Ready)
|
|||||||
jQuery supports automatically reapplying event handlers when new DOM elements get inserted, mostly through Ajax calls.
|
jQuery supports automatically reapplying event handlers when new DOM elements get inserted, mostly through Ajax calls.
|
||||||
This "binding" saves you from reapplying this step manually.
|
This "binding" saves you from reapplying this step manually.
|
||||||
|
|
||||||
Caution: Only applies to certain events, see the [jQuery.on() documentation](http://api.jquery.com/on/).
|
Caution: Only applies to certain events, see the [jQuery.on() documentation](http://api.jquery.com/on/#direct-and-delegated-events).
|
||||||
|
|
||||||
Example: Add a 'loading' classname to all pressed buttons
|
Example: Add a 'loading' classname to all pressed buttons
|
||||||
|
|
||||||
@ -261,14 +261,11 @@ Example: Add a 'loading' classname to all pressed buttons
|
|||||||
});
|
});
|
||||||
|
|
||||||
// binding, applies to any inserted elements as well
|
// binding, applies to any inserted elements as well
|
||||||
$('input[[type=submit]]').on(function() {
|
$('.cms-container').on('click', 'input[[type=submit]]', function() {
|
||||||
$(this).addClass('loading');
|
$(this).addClass('loading');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
See [jQuery FAQ: Why do my events stop working after an AJAX
|
|
||||||
request](http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_AJAX_request.3F).
|
|
||||||
|
|
||||||
### Assume Element Collections
|
### Assume Element Collections
|
||||||
|
|
||||||
jQuery is based around collections of DOM elements, the library functions typically handle multiple elements (where it
|
jQuery is based around collections of DOM elements, the library functions typically handle multiple elements (where it
|
||||||
|
Loading…
Reference in New Issue
Block a user