我想讓我的表只用於Home_Score和Away_Score名稱的列可編輯如何將jquery onclick函數設置爲僅定位可編輯表格中的特定表格列或類?
//edit.js文件
$(function() {
//when a td element within tbody is clicked
$('tbody').on('click','td',function() {
//call displayform, passing td jQuery element
displayForm($(this));
});
});
//table.php文件
<?php
$sql = "SELECT * FROM predict WHERE Fixture_ID BETWEEN '1' and '10' ";
$results = $dbh->query($sql);
$rows = $results->fetchAll();
foreach ($rows as $row) {
echo '<tr id="'.$row['Fixture_ID'].'">';
echo '<td class="Home_Team">'.$row['Home_Team'].'</td><td class="Home_Score">'.$row['Home_Score'].'</td>';
echo '<td class="Away_Score">'.$row['Away_Score'].'</td><td class="Away_Team">'.$row['Away_Team'].'</td>';
echo '</tr>';
}
?>
開始'元素代替主頁和離開文本。 – hoss