When I click on the li
I got a new li
created. However clicking I want the same event on the new list items so I used:
$('ul').on( 'click', $this, function(){
But now the content is duplicated!
<ul>
<li>1</li>
<li>2</li>
</ul>
JS:
(function(){
$('li').each(function(){
var $this = $(this);
$('ul').on( 'click', $this, function(){
$('ul').append('<li>new</li>');
});
});
})(jQuery)
http://jsfiddle.net/24cnwmqv/1/
I just want when you click on the existing or new list items you got 1 new created list item. Thank you.