更改菜单属性下拉框样式

This commit is contained in:
Argo-Lenovo 2016-11-03 11:47:04 +08:00
parent ab004c78dc
commit 3ad24107cf
2 changed files with 19 additions and 1 deletions

View File

@ -187,4 +187,10 @@ $(function () {
scrollTop: 0
}, 200);
});
$('.form-group .btn-group .dropdown-menu a').on('click', function () {
var parent = $(this).parents('div.btn-group');
parent.children('input.hide').val($(this).attr("data-val"));
parent.children('button:first').text($(this).text());
});
});

View File

@ -77,7 +77,19 @@
</div>
<div class="form-group col-lg-6">
<label class="control-label" for="category">类别</label>
<input type="text" class="form-control" id="category" name="category" maxlength="50" />
<!-- Split button -->
<div class="btn-group">
<input type="text" class="form-control hide" id="category" name="category" value="0" />
<button type="button" class="btn btn-default">自定义菜单</button>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">下拉按钮</span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#" data-val="0">系统菜单</a></li>
<li><a href="#" data-val="1">自定义菜单</a></li>
</ul>
</div>
</div>
</form>
</div>