[英]Check checkboxes with another checkbox has been checked
我希望在以下復選框為true時選中我的復選框。在該復選框內,我正在使用Javascript代碼對其進行檢查。 使用mvc
@if (str_item != "" && str_checkroles != "" && str_item == str_checkroles) {
<script>
src = "https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" >
</script>
<script type="text/javascript">
$(function () {
$('#@(item.Text)').attr('checked', true);
$('#dummychk').prop('checked', true);
});
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
'item.Text'-文本框的ID?
請使用(以下答案是我根據“ item.Text”發布的,作為復選框的ID)
$('#item.Text')。attr('checked',true);
代替這個
$('#@(item.Text)')。attr('checked',true);
但是,我願意為您提供幫助。.請共享在html元素中使用的兩個復選框的ID。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.