From bd3cd9775e9e4e454c13e38e8ee8228f9826f462 Mon Sep 17 00:00:00 2001 From: Frank Sachsenheim Date: Wed, 3 Feb 2016 10:42:03 +0100 Subject: [PATCH] Fixes re-initialization upon adding inlines the rationale is that the elements an event are bound to must exist. this isn't the case for the specified selectors. i'd appreciate if this was released soon. solves #87 --- ajax_select/static/ajax_select/js/ajax_select.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ajax_select/static/ajax_select/js/ajax_select.js b/ajax_select/static/ajax_select/js/ajax_select.js index c279cc2bbf..644456fd7f 100644 --- a/ajax_select/static/ajax_select/js/ajax_select.js +++ b/ajax_select/static/ajax_select/js/ajax_select.js @@ -228,8 +228,8 @@ // if dynamically injecting forms onto a page // you can trigger them to be ajax-selects-ified: $(window).trigger('init-autocomplete'); - $('.inline-group ul.tools a.add, .inline-group div.add-row a, .inline-group .tabular tr.add-row td a') - .on('click', function() { + $(document) + .on('click', '.inline-group ul.tools a.add, .inline-group div.add-row a, .inline-group .tabular tr.add-row td a', function() { $(window).trigger('init-autocomplete'); }); });