From cacbbd75bc994f396a70005c8c6a90ce9a15d969 Mon Sep 17 00:00:00 2001 From: Ed Linklater Date: Sun, 1 Nov 2015 05:46:13 +1300 Subject: [PATCH] DOCS: jQuery delegation in Admin interface --- .../06_Javascript_Development.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/06_Javascript_Development.md b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/06_Javascript_Development.md index 5f846c393..ce4cffd3f 100644 --- a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/06_Javascript_Development.md +++ b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/06_Javascript_Development.md @@ -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. 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 @@ -261,14 +261,11 @@ Example: Add a 'loading' classname to all pressed buttons }); // binding, applies to any inserted elements as well - $('input[[type=submit]]').on(function() { + $('.cms-container').on('click', 'input[[type=submit]]', function() { $(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 jQuery is based around collections of DOM elements, the library functions typically handle multiple elements (where it