Jquery mobile listview - check initialization is complete

前端 未结 4 708
野性不改
野性不改 2020-12-11 15:24

I\'ve coded my way into a corner.

I need to call listview(\"refresh\") on a list, however it may not have been initialized at the point I am calling the

4条回答
  •  执念已碎
    2020-12-11 15:57

    you can simply create a global variable

    var is_mobile_init = false;

    at the top of your scripts. then set it to true after you include jquery mobile.

    then before refreshing write,

    if (is_mobile_init)
        $myUL.listview('refresh');
    

    this way, you don't need to keep track of all the various classes and it is intuitive

提交回复
热议问题