how to refresh the list in jquery javascript -
hi m having 1 page 1 textbox named search , 1 search button. when i'm searching first time it's showing me right data when i'm searching other things next time elements listed before appended below of new list. suppose i'm searching state name k give me right list of karnataka, kerala. if start search again g, show me in output goa,gujrat,karnataka kerala. tried using refresh option still not working. js code
$.each(response.state, function (i, state) { $('#statelist').append( '<li>' + '<a href="#">' + +'<b>'+ '<font color="green">'+'<h3>'+ state.name +'</h3>'+'</font>' +'</b>'+ '</a>' + '</li>' ); }); $('li img').width(100); $('.ui-li-icon li').click(function() { var index = $(this).index(); text = $(this).text(); // alert('index is: ' + index + ' , text ' + text); }); $("#statelist").listview("refresh");
and html
you using .append() function. appends whatever append end of list. check link: http://api.jquery.com/append/
try using innerhtml property of dom model.
Comments
Post a Comment