Hello all,
well i have a problem, but it sorta works. Here is my code.
var toggleState = 0
function toggleMe() {
if(toggleState == 0) {
alert("Checked");
toggleState = 1;
} else {
alert("Unchecked");
toggleState = 0;
}
}
HTML
<input type="checkbox" onclick="toggleMe()" />Toggle me
<input type="checkbox" onclick="toggleMe()" />Toggle me
The problem is that when i check box 1, i get an alert. When i click it gain, nothing. Now when i click it a third time for it to uncheck, then i get the alert and it works fine where i can do it on and off with the alerts. The only thing is now its backwards. Now, if i check the first one, alert works. If i do the second one while the first one is checked then again nothing, then it works on the 2nd click. I have tried if(this.attribute = "checked") { do something} else { if(this.attribute = "unchecked") { alert unchecked} but nothing. Im just really confused.