jQuery Mobile:$(...)。listview不是一个函数 [英] jQuery Mobile: $(...).listview is not a function
本文介绍了jQuery Mobile:$(...)。listview不是一个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在UL中动态插入LI元素后,在jQuery Mobile中刷新listview。
每当我在控制台上尝试 $(#myUL)。listview('refresh');
时,我会收到错误:
I'm trying to refresh a listview in jQuery Mobile after a dynamic insert of LI elements in an UL.
Whenever I try $("#myUL").listview('refresh');
, on the console I get the error:
未捕获TypeError:$(...)。listview不是函数
Uncaught TypeError: $(...).listview is not a function
我该如何解决这个问题?
How can I solve this?
推荐答案
确保在jquery.mobile之前包含jquery
Make sure you include jquery before jquery.mobile in head
... src="lib/jquery-1.11.3.min.js"
... src="lib/jquery.mobile-1.4.5.min.js"
在刷新之前检查DOM是否准备就绪with:
Check that the DOM is ready before doing refresh with:
$(document).ready(function(){
$('#playlist').listview('refresh');
});
这篇关于jQuery Mobile:$(...)。listview不是一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文