I have a list of items that I can select but when I append additional items the new items are not able to be selected.
HTML
<ul id="list">
<li attrit="AddInfo">item 1</li>
<li attrit="MoreInfo">item 2</li>
</ul>
<button id="ud">update</button>
JQuery
$(document).ready(function() {
$('#ud').click(function() {
$.post("page", function(data){
$('#list').append(data);
});
});
$('#list ul').click(function(){
$(this).addClass("selected").siblings().removeClass("selected");
});
});
I am unable to select any of the items that are appended after the initial page is loaded.
What is the best way to address this?