gpt4 book ai didi

jquery-mobile - jQuery Mobile : Uncaught cannot call methods on checkboxradio prior to initialization; attempted to call method 'refresh'

转载 作者:行者123 更新时间:2023-12-04 06:36:25 24 4
gpt4 key购买 nike

我正在解决这个问题。
这些是我使用并引起上述问题的代码。

$(document).ready(function () {
$("#at-site-btn").bind("tap", function () {
$.mobile.changePage("view/dialog/at-site.php", { transition:"slidedown", role:"dialog" });
});
$('#at-site-page').live('pagecreate', function(){
var $checked_emp = $("input[type=checkbox]:checked");
var $this = $(this);
var $msg = $this.find("#at-site-msg");
$checked_emp.appendTo($msg);
$checked_emp.trigger('create');
$msg.trigger('create');
$(document).trigger('create');
$this.trigger('create');
$("html").trigger('create');

});
});

解释:

上面的代码在名为hod.php的文件中。该文件包含许多复选框。这些复选框同时被选中,当我按下#at-site-btn按钮时,at-site.php出现(作为对话框)并显示每个选中的复选框。

这是发生问题的地方。当我在对话框中按“后退”按钮返回上一页并尝试取消选中这些复选框时,错误弹出,如标题中所述。我的代码中没有对“刷新方法”的调用,因此我看不到解决此问题的方法。
  • 任何人都可以提出解决此问题的方法吗?
  • 我使用的对吗? (我对jQuery Mobile非常陌生。如果使用JQM背后有一些概念,请向我解释[我尝试阅读JQM Docs,对我来说似乎不太清楚])。

  • 最好的问候,非常感谢您的回答。

    最佳答案

    您正在使用哪个版本的jQueryMobile?您可能需要使用pageinit而不是pagecreatejQueryMobile documentation的这一部分讨论选择。

    对于重新绘画或创建,solution that @Taifun指出,它类似于:

    $("input[type='radio']").checkboxradio();
    $("input[type='radio']").checkboxradio("refresh");
    对我来说还可以,但它不能正确地绘制控件的100%。单选按钮的边缘未涂圆角。

    在我看到您的代码之前,我 read here可以在容器对象上调用 .trigger('create'),它对我有用。您正在执行此操作,但是在 pagecreate内部而不是 pageinit中。

    关于jquery-mobile - jQuery Mobile : Uncaught cannot call methods on checkboxradio prior to initialization; attempted to call method 'refresh' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12691780/

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