Checkbox 如何获取bootstrap4复选框的值?
我有以下复选框:Checkbox 如何获取bootstrap4复选框的值?,checkbox,bootstrap-4,Checkbox,Bootstrap 4,我有以下复选框: <label class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" id="modal_checkbox"> <span class="custom-control-indicator"></span> <span class="custom-control-desc
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="modal_checkbox">
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Do not show me this again.</span>
</label>
不要再给我看这个了。
但是我不知道如何使用jquery获取复选框的值。我试图获取上述类和ID的属性或道具,但是我得到了一个“未定义的”这是bcoz,您没有value属性。检查此代码
$(函数(){
console.log($(“#modal_checkbox”).val();
});代码>
不要再给我看这个了。
这是bcoz,您没有值属性。检查此代码
$(函数(){
console.log($(“#modal_checkbox”).val();
});代码>
不要再给我看这个了。
这可能是因为您没有值属性。这可能是因为您没有值属性。