码迷,mamicode.com
首页 > Web开发 > 详细

bootstrap和JS实现下拉菜单

时间:2019-08-21 21:34:08      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:group   菜单   cli   htm   href   exp   The   pop   rop   

// bootstrap下拉菜单
<div class="btn-group">
  <button id="button_text" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Action <span class="caret"></span>
  </button>
  <ul class="dropdown-menu">
    <li><a href="#" class="a-1">Action</a></li>
    <li><a href="#" class="a-1">Another action</a></li>
    <li><a href="#" class="a-1">Something else here</a></li>
    <li role="separator" class="divider"></li>
    <li><a href="#" class="a-1">Separated link</a></li>
  </ul>
</div>
// 点击拉下框选项,替换展示内容
$(".a-1").click(function () { var val = $(this).html(); $("#button_text").text(val) })

 

bootstrap和JS实现下拉菜单

标签:group   菜单   cli   htm   href   exp   The   pop   rop   

原文地址:https://www.cnblogs.com/aaronthon/p/11391237.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!