jqery和js如何判断checkbox是否选中 (转)

it2022-05-22  49

 

jquery:

<div id="divId" class="divTable"><div class="tableBody"><ul ><li ><input type="checkbox" value="501" ></li></ul></div></div>

$("input[type='checkbox']").attr('value')返回结果:501$("input[type='checkbox']").is(':checked')返回结果:选中=true,未选中=false

 

 

js:

if(document.getElementById("checkboxID").checked){    alert("checkbox is checked");}

       

转载于:https://www.cnblogs.com/quanfu2326/p/4600314.html


最新回复(0)