Capture first text on first iteration
Hi Everyone;
I'm using jquerymobile for a project on phonegap.
I have a dinamic listview
- for(i = 0; i < qtty; i++){
- html += "<li><a href='#listingresults' class='byCounties'>"+Counties[i].Name+", "+Counties[i].CityName+", "+Counties[i].Abbrevation+"</a></li>";
- }
-
- $('#counties_ li').remove();
- $('#counties_').append(html);
- $('#counties_').listview('refresh');
When I try to get the content of the link in the li using $(this).text(); the first time it always returns an empty string, but the next time I do it, I get the right text
- $("#counties_ li a.byCounties").live("tap", function(){
- $('#listViewResults a').remove();
- $('#listViewResults li').remove();
- var countyCity = $(this).text();
- alert(countyCity);
- });
When I clicked the first time the alert is empty or isn't show up. But in the second time the alert works fine.