Wednesday, January 18, 2012

Solved - Edit jQuery Mobile nested-list - Event


I'm trying to add a clicked elements into a jquery mobile nested list. I'm having no problem adding the item but I'm having problem changing the text and url on the item (link).



I can see the correct list about 0,5 seconds before it refreshes and everything is the same.



What event can I use to edit a list-item after being listed?



I've tried to run the code from firebug console and everything works , see code below:




var test = $('.ui-page-active .ui-listview > li > div > div a').first().text();
var data = $('body').data('mobilMenu');
var url = $(data).find('a').filter(function() {
return $(this).text() === test;
}).attr('href');


$('.ui-page-active .ui-listview > li > div > div a').first().text(test +" - hovedside");
$('.ui-page-active .ui-listview > li > div > div a').first().attr("href", url);



This solves the problem




$( "[data-role='page']" ).live( 'pagehide',function(event, ui){



. had the wrong selector

No comments:

Post a Comment