jquery mobile click() on listview -


i have problem listview in jquery mobile. want load data server using json , fill thy listview items. works fine. when trying react on click on new loaded item net event! think have refresh view somehow, bit not know how.

i made little sketch on http://jsfiddle.net/vqulm/227/

when u hit click me button click event on item isn't tracked anymore. how "wokrs" alert on new items?

thank u reading!

try

    $('#listview').on('click', 'li', function() {         alert("works"); // id of clicked li directly accessing domelement property     }); 

with jquery > 1.7

demo

or

$('#listview li').live('click', function() {     alert("works"); // id of clicked li directly accessing domelement property }); 

with jquery version 1.6.4.

demo

why need this

because. you're adding li within listview after page reload, event lis should live (for jquery version used) or delegate (jquery > 1.7).


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -