Help me debug my code where I am attempting to connect a checkbox to a vector layer's 'visible' property. I can't seem to figure out what's wrong, can you spot the error?
Interestingly, this code successfully works for ol.layer.Tile, but for some reason, it's not functioning as expected with ol.layer.Vector. Strangely, the 'opacity' binding works perfectly fine.
var list = document.getElementById('some-ul-element')
....
var li = document.createElement('li');
var checkbox = document.createElement('input');
checkbox.setAttribute('type','checkbox');
checkbox.setAttribute('checked',true);
li.appendChild(checkbox);
var label = document.createElement('label');
label.appendChild(document.createTextNode(layer.get("title")));
li.appendChild(label);
var range = document.createElement('input');
range.setAttribute('type','range');
range.setAttribute('min','0');
range.setAttribute('max','1');
range.setAttribute('step','0.01');
range.setAttribute('value','1');
li.appendChild(range);
new ol.dom.Input(range).bindTo('value',layer,'opacity');
new ol.dom.Input(checkbox).bindTo('checked',layer,'visible');
....
list.appendChild(li)