multiple Sumo select Ok click events

落花浮王杯 提交于 2019-12-25 02:44:26

问题


How do I make sure that the Sumo select Ok click event is different for different selects.

Similar unanswered question here

This is I have tried in jsfiddle but can't get it work.

https://jsfiddle.net/dew3nmja/

<select id="island" multiple>
    <option value="Big Island">Big Island</option>
    <option value="Oahu">Oahu</option>
    <option value="Kauai">Kauai</option>
    <option value="Maui">Maui</option>
</select>
<select id="island2" multiple>
    <option value="Big Island2">Big Island2</option>
    <option value="Oahu2">Oahu2</option>
    <option value="Kauai2">Kauai2</option>
    <option value="Maui2">Maui2</option>
</select>

/// I get these classes from Developer tools and tried to iterate through it but no luck.

$('#island').next(" .MultiControls .btnOk").click( function () {
       alert('okk');
 });

 $('#island2').next(" .MultiControls .btnOk").click( function () {
       alert('222');
 });


回答1:


You have to use #island ~ .optWrapper .MultiControls .btnOk

$("#island ~ .optWrapper .MultiControls .btnOk").click( function () {
   alert('okk');
});

if you look at #island then the next object that contains your .btnOk is .optWrapper



来源:https://stackoverflow.com/questions/55255277/multiple-sumo-select-ok-click-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!