Let userDice=[
{'dice': 0, 'checked': false,’id’ : “d1”},
{'dice': 0, 'checked': false, ’id’ : “d2”},
{'dice': 0, 'checked': false, ’id’ : “d3”},
{'dice': 0, 'checked': false, ’id’ : “d4”},
{'dice': 0, 'checked': false, ’id’ : “d5”}
]
// click function
$("#d1Check"). click(function() {
if (userDice{0].checked)
{
userDice{0].checked = false;
alert("false")
}
else
{
userDice[0].checked = true;}
alert(“true”)
})
})
Can anyone explain to me what the click function does? I know it keeps my checkbox checked even if i shuffle/roll my dice and won’t change the value but I’d like to understand how to read it. I’ve been reading it as when i click my function of the id=d1check, if user dice of the first one I’m on is checked it’s false or else it’s true? But if i checked it wouldn’t it be true and not false? TIA for the help
Aucun commentaire:
Enregistrer un commentaire