Hi errant, Thank you very much for quick reply. Now it works good using live method. Your solution saves my lot of time.
with Regards sure. On Mar 11, 1:32 pm, errant <d.cheka...@gmail.com> wrote: > That's because events are binded to existing elements. > > If you're using 1.3.x, take a look at "live" > method:http://docs.jquery.com/Events/live#typefn. With previous versions, > livequery plugin may be helpful:http://docs.jquery.com/Plugins/livequery > > On 11 мар, 09:25, sure <sure.2...@gmail.com> wrote: > > > Hi all, > > I am new to jquery. My close click event function dosen't > > work, when ever i append new html data to my div. Intially it is > > working fine with static data. Please help me to fix this problem. > > > $(function() > > { > > $("#addrow").click(function() > > { > > alert($("#mainlayout .row").length); > > var len = parseInt($("#mainlayout .row").length); > > var html ="<div id=\"row1\" class=\"row\"><ul > > class=\"ulpanel > > \"><li><div class=\"close\" ><img src=\"images/delete.png\" /></ > > div><div>1</div></li><li><div class=\"close\"><img src=\"images/ > > delete.png\" /></div><div>2</div></li><li><div class=\"close\"><img > > src=\"images/delete.png\" /></div><div>3</div></li></ul></div>"; > > $("#mainlayout").append(html); > > //$(".ulpanel li").draggable(); > > }); > > > $(".close").click(function() > > { > > > > //alert($(this).parent().parent().parent().attr("class")); > > //alert(parseInt($(".ulpanel li").length)); > > if($(".ulpanel li").length==1) > > $(this).parent().parent().parent().remove(); > > else > > $(this).parent().remove(); > > }); > > > }); > > > with Regards > > sure > >