Fixed #26357 -- Allowed admin popups to work on links added after page load.
This commit is contained in:
parent
6fdb12cdcc
commit
adc93e8599
|
@ -162,7 +162,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.related-widget-wrapper select').trigger('change');
|
$('.related-widget-wrapper select').trigger('change');
|
||||||
$('.related-lookup').click(function(e) {
|
$('body').on('click', '.related-lookup', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var event = $.Event('django:lookup-related');
|
var event = $.Event('django:lookup-related');
|
||||||
$(this).trigger(event);
|
$(this).trigger(event);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var modelName = $('#django-admin-form-add-constants').data('modelName');
|
var modelName = $('#django-admin-form-add-constants').data('modelName');
|
||||||
$('.add-another').click(function(e) {
|
$('body').on('click', '.add-another', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var event = $.Event('django:add-another-related');
|
var event = $.Event('django:add-another-related');
|
||||||
$(this).trigger(event);
|
$(this).trigger(event);
|
||||||
|
|
|
@ -24,6 +24,12 @@ Code style
|
||||||
JSHint will be run when you run the JavaScript tests. We also recommended
|
JSHint will be run when you run the JavaScript tests. We also recommended
|
||||||
installing a JSHint plugin in your text editor.
|
installing a JSHint plugin in your text editor.
|
||||||
|
|
||||||
|
* Where possible, write code that will work even if the page structure is later
|
||||||
|
changed with JavaScript. For instance, when binding a click handler, use
|
||||||
|
``$('body').on('click', selector, func)`` instead of
|
||||||
|
``$(selector).click(func)``. This makes it easier for projects to extend
|
||||||
|
Django's default behavior with JavaScript.
|
||||||
|
|
||||||
.. _javascript-patches:
|
.. _javascript-patches:
|
||||||
|
|
||||||
JavaScript patches
|
JavaScript patches
|
||||||
|
|
Loading…
Reference in New Issue