mercredi 26 mai 2021

CheckBox value always returns true

The checkbox which I had set using a variable always returns the value of variable and the checkbox is always checked. If the value is true it returns true and vice versa

answerOption={isCorrect:true}
<input type="checkbox" checked={(!answerOption.isCorrect) ? false : true}  onChange={this.updateAnswerChecked.bind(this)}  style="cursor:pointer;" />
updateAnswerChecked(e){
   console.log(e.target.checked);
   answerOption.isCorrect = e.target.checked
}



Aucun commentaire:

Enregistrer un commentaire