首页 > bootstrap如何通过选择下拉框把选择的值赋值给下拉框button?

bootstrap如何通过选择下拉框把选择的值赋值给下拉框button?

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
<!-- <link href="css/ejoy.css" rel="stylesheet" /> -->
<link href="http://libs.baidu.com/bootstrap/3.0.3/cs... rel="stylesheet">
<script src="http://libs.baidu.com/jquery/2.0.0/jquer...
<script src="http://libs.baidu.com/bootstrap/3.0.3/js...

</head>
<body>

<div class="mainmenu">

<div class="dropdown pull-right">
<button id="dLabel" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">

Dropdown trigger
<span class="caret"></span>

</button>
<ul class="dropdown-menu" aria-labelledby="dLabel" style="">

 <li tabindex="-1">aa</li>
 <li tabindex="-1">bb</li>
 <li tabindex="-1">cc</li>
 <li tabindex="-1">dd</li>

</ul>
</div>
</div>
</body>
</html>

比如当选中某项是 button的文本值等于选中项


https://jsfiddle.net/La5tnaqo/

【热门文章】
【热门文章】