Hi there, quick question about onchange method usage. I have a couple of checkboxes and when I check/uncheck them I want a function to be called, therefore I have decided to use the onchange method. But I am not sure I get how this works. Take the following example:
HTML
<input type="checkbox" value="apple" name="fruit" checked="checked" id="apple" onchange="myFunction()"><label for="apple">Apple</label><br>
and here's the function:
function myFunction(){
var update = false;
console.log("update is " + update);
}
When the code runs, the message in the console is displayed even if I don't touch the checkbox...how's that possible? I would have thought that myFunction would run only if I had checked/unchecked the box
thanks