<?php
if(isset($_POST['take-attendance'])){
$date = date("d/m");
echo'<center><table><tr><th> Student-Id </th> <th> Name </th> <th>'.$date.'</th></tr>';
foreach($sheet_data as $row) {
echo '<tr><td>'.$row['id'].'</td><td>'.$row['name'].'</td><td> <input type = "button" value = "A" name = "'.$row['id'].'" id = "'.$row['id'].'" class = "apbutton" ></td></tr>';
}
echo '</table></center>';
}
?>
<script>
$(".apbutton").live("click", function() {
var buttonId = $(this).attr("id");
alert(buttonId);
});
</script>
ここで、クラス apbutton nd を使用して入力ボタンを生成しました。ボタン ID を取得しようとしていますが、これが機能していません。どこが間違っているのか教えてください。