jQuery mobile error “cannot call methods on listview prior to initialization”

前端 未结 7 1075
北海茫月
北海茫月 2020-12-25 13:11

I\'m dynamically filling a

    then calling location.href=\"#Results\" where the list is, and finally listview(
7条回答
  •  隐瞒了意图╮
    2020-12-25 13:50

    you should check if it is already initialized or not, refresh the list in case it is initialized otherwise trigger create as per the following :

    if ( $('#myListview').hasClass('ui-listview')) {
        $('#myListview').listview('refresh');
         } 
    else {
        $('#myListview').trigger('create');
         }
    

提交回复
热议问题