Set Select Option 'selected' In A Modal Bootstrap
I have a select field and I have to select one of those options with jQuery. I have this method, and it works for me anywhere, except in a modal. When I open my target page, it ope
Solution 1:
you should place your script before the html code of the modal as below.
<script>
var echelle= document.getElementById('echelle');
echelle.value = 'trimestrielle';
</script>
<div class='modal small fade' id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<form method="post" action="UpdateMPrev" >
<select id="echelle" name="echelle" class="form-control">
<option value="mensuelle"> Mensuelle</option>
<option value="trimestrielle">Trimestrielle</option>
<option value="semestrielle" > Semestrielle</option>
<option value="annuelle" > Annuelle</option>
<option value="aucun"> Aucun</option>
</select>
<input type="submit"/>
</form>
</div>
</div>
</div>
Post a Comment for "Set Select Option 'selected' In A Modal Bootstrap"