1
現在我得到的價值,如果我選擇複選框(ID被選中), ,但如何獲得值時,我未選定(ID是未選中)?jquery,取消選擇複選框
例如我推1,我得到價值1.當我取消選擇1,我得到價值1. 我希望你明白我的問題。
<script>
$(document).ready(function()
{
$("input[type=checkbox]").change(function(event){
$("#result").html("&id=" + this.value);
});
});
</script>
</head>
<body>
<input type="checkbox" name="checkbox_pref" value = "1"/>1
<input type="checkbox" name="checkbox_pref" value = "2"/>2
<input type="checkbox" name="checkbox_pref" value = "3"/>3
<div id="result">result ...</div>
..我只是嘗試這樣做,也沒有工作。 http://jsfiddle.net/8nhYq/。你確定這有效嗎? – Hristo 2010-08-10 20:18:03
謝謝,我修復了語法錯誤,請嘗試:http://jsfiddle.net/8nhYq/1/,用有效的JS更新後 – 2010-08-10 21:10:33