Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Mobile: $(...).listview is not a function

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:

Uncaught TypeError: $(...).listview is not a function

How can I solve this?

like image 330
Michele Stieven Avatar asked Aug 06 '26 13:08

Michele Stieven


1 Answers

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"

Check that the DOM is ready before doing refresh with:

$(document).ready(function(){
    $('#playlist').listview('refresh');
});
like image 71
holmberd Avatar answered Aug 09 '26 03:08

holmberd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!