gpt4 book ai didi

jquery - 从函数中取消选中 JQuery UI 复选框

转载 作者:行者123 更新时间:2023-12-01 02:30:31 25 4
gpt4 key购买 nike

使用 http://jqueryui.com/button/#checkbox 中的复选框(不是按钮组)

并且想要一个重新开始按钮来取消选中所有 JQuery 复选框,使用 Jquery UI 将复选框创建为输入,以便下面的 prop 不起作用

 <script>
$(function() {
$( "#startover" ).click(function() {
$("#mycheck").prop("checked", false);
});
});

代码:

<input type="checkbox" id="mycheck" ><label for="mycheck">clickme</label>

最佳答案

使用refresh更新 UI 控件的视觉状态的方法。

引用:

Refreshes the visual state of the button. Useful for updating button state after the native element's checked or disabled state is changed programmatically.

代码:

 $(function () {
$("#mycheck").button();
$("#startover").click(function () {
$("#mycheck").prop("checked", false);
$("#mycheck").button("refresh");
});
});

演示:http://jsfiddle.net/IrvinDominin/TyWcP/

关于jquery - 从函数中取消选中 JQuery UI 复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18751248/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com