I have some javascript that on page load reads a group of check boxes checking their checked status. If the checkbox is checked then a value is added to an array which is later used.
var _chkBoxes = document.getElementsByName("chkProduct");
var _chkBoxesLen = _chkBoxes.length;
var _chkArray = [];
for (var i = 0; i < _chkBoxesLen; i++) {
if (_chkBoxes[i].checked === true) {
_chkArray.push(_chkBoxes[i].id.split("-")[1]);
console.log(_chkArray);
}
}
This works fine for all browsers when the page is freshly loaded.
However in IE if a user ticks some boxes, navigates to another page then pushes the back button then this work does not recognise that checkboxes have been previously checked, even though on the page they are.
Is this a bug with IE and whats the fix, any opinions appreciated!