I am trying to change the background color of a label in each checkbox in a form based on the checked/unchecked state of the checkbox.So far I got it to change initially, but it
http://jsfiddle.net/7wnCL/20/
myLayer.checked = true
is an assignment, not a condition.
if (myLayer.checked = true)
is every time evaluated as
if (true)
And the else part will never be executed. So change it to:
if (myLayer.checked === true)
Also, you should check for the input, and not for the layer, which doesn't have any checked property:
if (myLayer.childNodes[0].checked === true)