select 下拉框多选
需要引入插件:fselect.js (此插件依赖jQ) 和 fselect.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()
//取值 value
var value = [].map.call($('.fs-option.selected'),function(el){return el.dataset.value})
P.S.:select 多选一定要加上 multiple="multiple"