【发布时间】:2017-04-20 07:56:02
【问题描述】:
我有两个复选框,一个带有label,一个没有:
$('#b').click(function() {
$('#ch1').prop('checked', true);
$('#ch3').prop('checked', true);
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<label for="ch1">Box 1</label>
<input type="checkbox" id="ch1" name="check1" />
<input type="checkbox" id="ch3" name="check2" />
<button id="b">click here</button>
点击按钮后,两个复选框似乎都被选中,但只有第二个显示“勾号”。如何刷新带标签的复选框?
【问题讨论】:
-
两者都在点击按钮时被选中。
-
这是css文件:添加
标签: jquery checkbox label refresh