【发布时间】:2021-09-01 07:05:52
【问题描述】:
我尝试冻结复选框,但它不起作用。我提到复选框的名称为 is_top_property。请帮助我。代码在这里
<div class="panel">
<div class="panel-title"><strong>{{__("Top Property")}}</strong></div>
<div class="panel-body">
<div class="form-group">
<input type="checkbox" name="is_top_property" onclick="check();" @if($row->is_top_property) checked @endif value="1"> {{__("Enable Top Property")}}
<script>
public function check(){
if($("is_top_property").is(":checked")){
alert("Thanks for selecting");
$('is_top_property').attr('disabled',true);
}
}
</script>
</div>
</div>
</div>
【问题讨论】:
-
向输入添加一个类,如
class="is_top_property,然后在$("is_top_property")中添加缺少的.。因为$("is_top_property")表示您正在寻找<is_top_property>元素,而该元素当然不存在。 -
public function check(){??这是 JavaScript,不是 JAVA。删除公众