1
我在這裏錯過了什麼?兄弟們給對象#<HTMLSelectElement>沒有方法'each'
至於How can i change options in dropdowns if it is generated dynamically?
答案的一部分,我有一個onchange內部的問題。我想所有的兄弟姐妹值設定的改變選擇
$("select").on("change",function() {
var idx=$(this).val();
console.log($(this).attr("id"),$(this).val())
$(this).siblings("select").each(function() {
$(this).val(idx);
});
});
這裏的值是一個JSFIDDLE
生成的代碼我見過
How do i get the value of all other dropdowns when one of them is changed
但我更喜歡找到我的錯誤原因
+1是的,這是問題...的'each'製作錯誤不是OP代碼中可見的錯誤! –
謝謝 - 將在5分鐘內接受 - 非常容易混淆,每個給出這樣的錯誤... – mplungjan
@mplungjan不客氣,其實錯誤與未定義的值有關。 – undefined