목록을 만든 후에 목록을 만든 후에 ".each"를 사용하여 모두 처리하고 클릭 절차를 적용하려고합니다.jQuery .attr 함수가 올바르게 반환되지 않습니다.
이 같은 내 코드가 잘 작동하지:
$.ajax({
url: "./views/todoitems.view.php",
data: "cmd=list",
success: function(html){
$('#list-container').empty().append(html);
$('input:checkbox').each(function(){
$check = $(this);
$check.click(function(){
alert($(this).attr('itemid'));
});
});
}
});
을하지만, 최대한 빨리 할 경고를 변경할 때
alert($check.attr('itemid'));
그것은 오직에는 목록의 마지막 항목의 ID를 보여줍니다 클릭 한 물건. 내가 뭘 잘못하고 있니?