<?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 的输入按钮,我正在尝试获取按钮 id,但这不起作用请告诉我我错在哪里