I am trying to rebind the li tags by removing it and again rebinding it. The ul tag is generated dynamically. My code to remove the li tags is this…
$("#ulActivity li").remove();
this line is removing all li tags perfectly, but append new set of li is not working…
$.each(objTaskActivityList, function(i,v){
$("#ulActivity ul").append('<li><a onclick="javascript:openfile(\''+v.DOCName+'\')">'+v.DOCName+'</a></li>');
});
where i am doing mistake..
I think you should do
$(“#ulActivity ul”) targets an
<ul>that is a descendant of the element with id= ulActivity, which i think is your<ul>In any case you should try to handle situations like these with an approach that is different from “Remove” and “Reattach”, but how to that exactly depends from your needs