我想檢查是否有任何其他與當前選擇匹配的選定值。所以當.payment-method
變化我得到的價值,並檢查其他.payment-method
s的值。我想排除觸發更改的下拉菜單。 .not(this)
不起作用。從觸發事件的所有下拉菜單中獲取選定值
$(document).on('change', '.payment-method', function() {
var thisVal = $(this).val();
console.log("this value" + thisVal);
$(".payment-method option:selected").not(this).each(function() {
console.log($(this).val());
});
});