gpt4 book ai didi

jquery - Bootstrap 选择菜单进入下拉菜单

转载 作者:行者123 更新时间:2023-12-01 04:50:16 24 4
gpt4 key购买 nike

I have a select option in a form, but i need it to be bootstrap select button,I tried but failed with it,I think plugings are wrong or something.

           <select name="city">
<option value="Sydney">Sydney</option>
<option value="Brisbane">Brisbaneo</option>
<option value="Melbourne">Melbourne</option>
<option value="Canberra">Canberra</option>
<option value="Darwin">Darwin</option>
<option value="Perth">Perth</option>
</select>
<li><input name="submit" type="submit" /></li>
</ul>

</form>

This is my try :-

<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Select City
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="#">Sydney</a></li>
<li><a href="#">Brisbane</a></li>
<li><a href="#">Melbourne</a></li>
<li><a href="#">Canberra</a></li>
<li><a href="#">Darwin</a></li>
<li><a href="#">Perth</a></li>

</ul>

<script>
$(document).ready(function() {
$('.dropdown-toggle').dropdown();
});
</script>

php for this list

if(isset($_POST['submit'])) {
switch($_POST['city']) {
case 'gampaha': $to = 'to1@gmail.com'; break;
case 'colombo': $to = 'to2@hotmail.com'; break;
}
}

最佳答案

正如您在这里看到的,您的 fiddle :http://bootply.com/104533

您需要将代码包装在 div class="dropdown"

<div class="dropdown">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Select City
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="#">Sydney</a></li>
<li><a href="#">Brisbane</a></li>
<li><a href="#">Melbourne</a></li>
<li><a href="#">Canberra</a></li>
<li><a href="#">Darwin</a></li>
<li><a href="#">Perth</a></li>

</ul>
</div>

没有的话,它就不起作用。

关于jquery - Bootstrap 选择菜单进入下拉菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21014171/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com