1
Just attach your click event
to already present element
which seems to be div.infor-experience
, since your modal
html
gets appended after DOM load
. Also, make sure your script
renders in web browser if you have provided any conditions for them to render.
$('.infor-experience').on('click', '.submit', function(e) {
alert("TEST");
})
0
It might be that positioning of your script. At the time of its execution the DOM may not be ready or exist yet.
You could wrap your DOM related codes like so:
$(document).ready(init);
function init(){
$('.add-to-list').on('click', '.submit', function(e) {
alert("TEST");
})
}
- Django. Q objects dynamicaly generate
- Wagtail mock images show as broken in admin but visible on template
- Django One-To-One and One-To-Many Relations
- Navigation links not working in navbar (Bootstrap)(Django)
0
Try this instead
$(document).ready(function () {
$('.add-to-list').on('click', '.submit', function(e) {
alert("TEST");
});
});
you should add the code under $(document).ready() so that it waits for whole DOM to load and then attaches the method instead doing so before loading of DOM.
- 'QueryDict' object has no attribute 'association'
- Accessing the Input Type from forms in Django
- Django native query v "homemade" sql query to json
- Notification received but no icon displayed in notification bar
Source:stackexchange.com