I have a todo list app. It has a column called completed which has true or false values. I want the checkbox to be checked if completed is true. I came up with the following:
echo "<label>".$row["name"]."</label>
<input onload='choose(".$row["completed"].")' class='sssss' value='".$row['id']."' type='checkbox'/>";
And
<script src='js/jquery.js'></script>
<script>
function choose(a) {
$(this).attr('checked', a);
}
</script>
But it isn't working. Please help
Edit
I believe that the js code is only using the first column value for all checkboxes
Aucun commentaire:
Enregistrer un commentaire