|
|
<input type="checkbox" id="test1"></input>alert($("#test1").val()) //无论是否选中都输出on
<input type="checkbox" id="test2"></input>alert($("#test2").attr("checked")) //如果选中输出checked,未选中输出undefined
<input type="checkbox" id="test3"></input>alert($("#test2").attr("checked")?"1","0") //如果选中输出1,未选中输出0 |
|