須要引入插件:fselect.js (此插件依賴jQ) 和 fselect.css 下載php
點擊查看在線演示地址css
//html
<select class="demo" multiple="multiple"> <optgroup label="Languages"> <option value="cp">C++</option> <option value="cs">C#</option> <option value="oc">Object C</option> <option value="c">C</option> </optgroup> <optgroup label="Scripts"> <option value="js">JavaScript</option> <option value="php">PHP</option> <option value="asp">ASP</option> <option value="jsp">JSP</option> </optgroup> </select>
//js 初始化
$('.demo').fselect()
//取值
$('.fs-label').text()
P.S.:select 多選必定要加上 multiple="multiple" html