All good time!The problem is:
Cycle create div's on the page and at the end of it hung the processor.
by clicking on the div it should change the content, but the problem is that when I click on the desired block, the content always changes only the last block.Although as I understand it weighs a click handler on all the blocks and it needs to change the content on I need. What's the problem?
field
[data-view = "pole"] { width: 200px; height: 200px; background-color: rgb(80, 168, 190); float: left; margin: 2px; } .pole-blue { background: rgb(180, 70, 180); }
var home = document.getElementById('home'); for(var i = 0;i<10;i++) { var pole = document.createElement('div'); pole.dataset.item = i; pole.dataset.view = "pole"; home.appendChild(pole); pole.onclick = function() { if(this.className != 'pole-blue') { pole.className = 'pole-blue'; } } }