I have following html code.
<div class="list">
   <p id="item1">Item 1</p>
   <p id="item2">Item 2</p>
   <p id="item3">Item 3</p>
   <p id="item4">Item 4</p>
</div>
<input name="item1" type="checkbox"/>
<input name="item6" type="checkbox"/>
<input name="item5" type="checkbox"/>
And when i click on checkbox i want to add new <p> tag to the <div> with id like input's name. 
$('input').click(function(){
   $('.list').append('<p id="' + $(this).attr("name") + '"</p>'); 
});
But items with the same id should not be repeated! How can i check it?
I'm thinking i need to loop through my list of <p> something like this
$('.list p').each(function(){
    if (..element with same id exists..) {
        ....    
    } else {
       ('.list').append('<p id="' + $(this).attr("id") + '"</p>');    
    }
});
 
     
     
     
     
    