【发布时间】:2016-09-22 01:20:20
【问题描述】:
我正在使用bootstrap 的selectpicker 插件。现在我想找出最后选择或取消选择的选项。
<select class="selectpicker selection-criteria" multiple>
<option value="0" selected>Mustard</option>
<option value="1" selected>Ketchup</option>
<option value="2" selected>Relish</option>
</select>
现在,当任何option 是selected 或deselected 时,即使在canJs 中我也无法触发。但我可以在整个选择器上触发事件。
".selection-criteria change": function(el,ev){
val colNames = $(el).val() // it returns all the selection options value
}
但是我可以在selectpicker 的选项点击上触发任何事件吗?当任何选项更改时,我将获得该选项并知道它现在被选中或取消选中?我可以在 canJs 中这样做吗??
编辑:如果我选择或取消选择选项 0,那么我想获取该元素,即
<option value="0" selected>Mustard</option>
根据是现在选择还是取消选择,我会隐藏一些div。
【问题讨论】:
-
您想拥有所有选择的选项,还是想确切地知道最后选择或取消选择的东西是什么?最后你想达到什么目标?
-
我想确切地知道最后选择或取消选择的选项
-
你用的是can.Component还是can.Control?
标签: jquery twitter-bootstrap canjs