I have a dynamic array a[1,3] I have 3 checkboxes which have name and value and I want to default check them based on the dynamic array a. I want to pass inside defaultCheck each current child's value.Is that possible? Something like defaultChecked={giveCheck(self.value} and be executed in the beginning so the checkboxes get their default check status
<input type="checkbox" name="a" value="1" />
<input type="checkbox" name="a" value="2" />
<input type="checkbox" name="a" value="3" />
giveCheck(value) {
if(a.indexOf(value)>=0){
return true;
}
return false;
}
Aucun commentaire:
Enregistrer un commentaire