问题
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