Reputation: 4323
I'm using Bootstrap and using this to show a modal after a click event:
$('#make_selects_modal').appendTo("body").modal('show');
I need to be able to execute a function (called pickClient
) when this is shown. I tried something like this, but it doesn't work. Not sure of the correct syntax.
$('#make_selects_modal').appendTo("body").modal('show').pickClient();
Upvotes: 0
Views: 102
Reputation: 118937
From the Bootstrap documentation you can use events for this, specifically in your case the shown.bs.modal
event:
$('#make_selects_modal').on('shown.bs.modal', function () {
pickClient();
})
Upvotes: 2
Reputation: 32117
When the modal is visible, an event called shown.bs.model
is fired.
You can use
$('#make_selects_modal').on('shown.bs.modal', pickClient);
Upvotes: 4