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
or
$('#listview li').live('click', function() { alert("works"); // id of clicked li directly accessing domelement property }); with jquery version 1.6.4.
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
Post a Comment