为了使用
jQuery selectBox
,只需将其正确加载到页面上(例如
via CDN
)中。
$(document).ready(function() {
$("select").selectBox();
$("select").selectBox('settings', {
'menuTransition': 'fade',
'menuSpeed': 'fast'
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.selectbox/1.2.0/jquery.selectBox.js"></script>
<select class="selectBox">
<option value="0">Login Type</option>
<option value="1">Admin</option>
<option value="2">Customer</option>
</select>
注意
为了更有效地使用标记,在本例中,使用元素的
class
属性及其价值
selectBox
使用jquery选择它,例如:
您的标记:
<select class="selectBox">
通过以下方式选择:
$(".selectBox").selectBox();