Why change the color inside the div does not work?
问题 Div with the id is clicking, the div with class is not clicking. By clicking div I want to change the color. If the color input within the div class is not working, if it is out of div class it works normally. How do I fix this? var div = document.getElementsByTagName("div"); var divCount = div.length; var clickedDivId; for (var i = 0; i < divCount; i += 1) { div[i].onclick = function(e) { if (e.target.id) alert(this.id); clickedDivId = this.id; e.stopPropagation(); }; } function