Link to home
Start Free TrialLog in
Avatar of ABABBest
ABABBestFlag for Netherlands

asked on

Selectbox within bootbox dialog not returning value

Hello,

We have a problem wiht a selectbox when it is opened within bootbox dialog.
When we select a value form the selectbox not opened within bootbox we get the selected value, but when we put the same selectbox within bootbox dialog, and use jquery to read the selected item, we always get the first option value of the selectbox returned.

See this fiddle for more information, and click the selectboxes.

jsfiddle

Hope someone can help me.
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

A bootstrap modal creates a copy of your template - take a look at the fiddle in the console. You will see the <div id="ModalSchedule"> is still hidden - the modal is now in a new div

<div class="bootbox modal fade modal-darkorange in" role="dialog" tabindex="-1" style="display: block; padding-left: 17px;" aria-hidden="false">
...
</div>

Open in new window

Rather put your code in an event handler bound to a class(es) in your modal controls. That way you will get the event even though the html is copied to a new parent.
Avatar of ABABBest

ASKER

I don't know exactly what you mean. Can you adjust the fiddle to show me?
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you, i can make it work the way i wan't now!
You are welcome.