簡體   English   中英

啟用javascript的復選框並檢查它

[英]javascript to enable checkbox and check it

我刪除了支票並禁用了一個復選框:

$('#h12_1').removeAttr('checked');
$("#h12_1").prop("disabled", true); 

然后我想再次啟用它,然后檢查它。

$('#h12_1').removeAttr('disabled');
$('#h12_1').attr('checked','checked');

上面的語法重新啟用復選框但不檢查它。

我錯過了什么嗎? 一如既往的幫助。

而不是這個

$('#h12_1').attr('checked','checked');

嘗試這樣的事情

$('#h12_1').prop("checked",true);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM