I need to create a drop down check box list like here. The problem with the code over there is that it is not working in IE9. I'm getting an error saying getElementsByClassName is not a property in the below code:
var checkList = document.getElementById('list1');
var items = document.getElementById('items');
checkList.getElementsByClassName('anchor')[0].onclick = function (evt) {
if (items.classList.contains('visible')){
items.classList.remove('visible');
items.style.display = "none";
}
else{
items.classList.add('visible');
items.style.display = "block";
}
}
items.onblur = function(evt) {
items.classList.remove('visible');
}
Can someone please help me out on how to create a drop down check box list? Thanks.
Aucun commentaire:
Enregistrer un commentaire