以下为页面必须要引入的js和css.
<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script> <script src="jquery.selectric.min.js"></script> <link rel="stylesheet" href="selectric.css">
你的html:
<select> <option>北京市</option> <option>上海市</option> <option>南京市</option> <option>广州市</option> </select>
你的js调用:
$(function() {
$('select').selectric();
});
$('select').selectric('open'); // 展开
$('select').selectric('close'); // 关闭
$('select').selectric('destroy'); // 摧毁,不可用
$('select').selectric('refresh'); // 刷新
$('select').selectric('init'); // Reinitialize the plugin
// 或者可以这样...
var Selectric = $('select').data('selectric');
Selectric.open(); //
Selectric.close(); //
Selectric.destroy(); //
Selectric.refresh(); //
Selectric.init();