[jQuery] Click function dosen't work, after append new html data.

[jQuery] Click function dosen't work, after append new html data.


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