[Solved] append only one div out of others inside parent [closed]


Please check with this Code It might be help you.

    $(document).ready (function(e){
    var x = "<div><div id='a'>a0</div><div id='a'>a1</div><div
        id='a'>a2</div><div id='b'>b1</div><div id='b'>b1</div><div   
           id='c'>c1</div><div id='b'>b2</div></div>";
    $('#parent').append(x);
    $('#parent').find("div").each(function ()
    {
        var id = $(this).attr("id");
        var length = $('#parent').find("div#" + id).length;
        for (var i = 0; i < length; i++)
        {   
            if (i > 0)
            {
                $('#parent').find("div#" + id+":eq("+i+")").remove();
            }
        }
    });
  });

solved append only one div out of others inside parent [closed]