Reputation: 1143
Following is parent modal code (code 1):
$('#modal_parent').on('shown.bs.modal', function() {
.....
})
Following is how I open a modal inside "modal_parent" by calling Js function (code 2):
function editEntry(id){
$("#childmodal").modal();
}
Now, when code 2 is executed, why is code 1 also getting executed?
In short, when child modal is opened in a parent, why does parent modal opening code also get fired? Both these modals have different id
s as shown above.
Any custom code suggestions so as not to fire code 1 when code 2 gets executed ?
Upvotes: 0
Views: 382
Reputation: 14927
I'm not positive this will work, but you may give this a try:
$("#childmodal").on('shown.bs.modal', function(event) {
event.stopPropagation();
});
See the docs here
Upvotes: 1