For example I have a HTML table…
name | grade | action
bob | 1.0 | [button class="button" id='1']
jack | 2.0 | [button class="button" id='2']
john | 3.0 | [button class="button" id='3']
When I click the button,
to get the id…
$(function(){
$('.button').click(function()
var buttonid = this.id
});
});
so if I were to press buttonid 1 how do I get the name ‘bob’ without having to open the database?
Additionally if I press the button how do I get the values in each column? i.e. If I press button 3 how do I get grade 3.0 or get both name and grade?
Script that generates the row of the table
while(){
echo '<tr>';
echo '<td>'.$name.'</td>';
echo '<td>'.$grade.'</td>';
echo '<td> <input type="button" class="button" id="'.$id'"</td>';
echo '</tr>';
}
Try: