vendredi 24 juin 2016

Checkbox is always checked whatever I choose

Hello I am building a form with 1 checkbox. The rest of the form fields work fine but whether the checkbox is checked or not the value is always 'on'.

My code:

<input  id="checkbox_<?=$row['csid'];?>" type="checkbox" <?php if($row['feedbackVisible'] == 'yes') { echo "checked='true'";}?> >

and how i get value with jQuery:

var review_visible_website = $('#checkbox_'+ modalId).val();

The checkbox starts checked but if i uncheck it, it still gives me value 'on'. What am I doing wrong?




Aucun commentaire:

Enregistrer un commentaire