crescue
asked on
How to call a function on ANY checkbox in a table
I am populating a table with php, and I am adding a checkbox per ROW
I want to edit the CHECKBOX CLICKED , and with the code attached below, I am only checking THE FIRST ROW. Ex. if four rows are added, only the FIRST one is checked. I want to be able to check if the USER clicks ON ANY checkbox ROW
Tnx
I want to edit the CHECKBOX CLICKED , and with the code attached below, I am only checking THE FIRST ROW. Ex. if four rows are added, only the FIRST one is checked. I want to be able to check if the USER clicks ON ANY checkbox ROW
Tnx
while($row = $result->fetch_assoc()) {
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td><input type='checkbox' id='editar' name='editar' value='".e."' ><td></tr>",$row["fecha"], $row["job"],$row["tipo"],$row["valor"],$row["dinero"],$row["editar"]);
$total=$total+$row["valor"];
$total2=$total2+$row["dinero"];
$jobs=$jobs+1;
}
} else {
echo "0 results";
}
<script>
$(document).ready(function()
{
console.log('changed');
$('#editar').change(function()
{
if(this.checked === true)
{
alert('Load page to edit');
}
});
});
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Tnx for your prompt and accurate reponse