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

后端 未结 1 1642

I am pulling my hair out dealing with this problem. These are the code that I used and caused the mentioned problem.

$(document).ready(function () {
    $(\"         


        
1条回答
  •  生来不讨喜
    2021-01-12 19:34

    What version of jQueryMobile are you using? You might need to use pageinit instead of pagecreate. This portion of the jQueryMobile documentation talks about the choices.

    For re-painting or creation, the solution that @Taifun pointed out, which looks like:

    $("input[type='radio']").checkboxradio();
    $("input[type='radio']").checkboxradio("refresh");
    worked okay for me, but it didn't paint the controls 100% correctly. Radio buttons didn't get the edges painted with rounded corners.

    Before I saw your code, I read here that you can call .trigger('create') on the container object and it worked for me. You are doing that but inside pagecreate instead of in pageinit.

    0 讨论(0)
提交回复
热议问题