Fix modal opener buttons not working when added to the DOM asynchronously. #228
parent
112b5359cf
commit
fca8e6d47b
|
|
@ -125,10 +125,12 @@ if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
|
||||||
var data = {
|
var data = {
|
||||||
lookup:(lookup === true ? true : false)
|
lookup:(lookup === true ? true : false)
|
||||||
};
|
};
|
||||||
|
// remove potential existing click event listener
|
||||||
var el = $(selector);
|
var el = $(selector);
|
||||||
el.removeAttr('onclick');
|
el.removeAttr('onclick');
|
||||||
el.unbind('click');
|
el.unbind('click');
|
||||||
el.click(data, presentRelatedObjectModal);
|
// listen the event on document for handling it on elements will be added to the DOM later
|
||||||
|
$(document).on('click', selector, data, presentRelatedObjectModal);
|
||||||
}
|
}
|
||||||
|
|
||||||
// assign functions to global variables
|
// assign functions to global variables
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue