There are several elements on the page that are clickable (I use the data-checked custom attribute). Repeated click removes this state. Everything works well, but you need to make a function that would clear all selected items and return them to their original state. Attach a button, she attached a function, but it does not work. Those. when I click for example 3-4 labels, and I call this function, then the selection is not removed from all. Try to select (press and gray) 4 marks, and then call the cleaning function. selection is removed only from two. This is some kind of nonsense.
This is the function that does the traversal, even iteration is written to the console fewer than expected.
var uncheck_all_cells = function () { var labels = document.getElementsByClassName("selected_cell"); Array.prototype.forEach.call(labels, function (label) { uncheck_cell(label); console.log("iteration"); }); console.log(labels); };