0

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(); 

2 Answers 2

4

When the modal is visible, an event called shown.bs.model is fired.

You can use

$('#make_selects_modal').on('shown.bs.modal', pickClient); 

Modal event docs.

Sign up to request clarification or add additional context in comments.

Comments

2

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(); }) 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.