I attempted to change the color of all elements in a certain class, but encountered an error:
Unable to convert undefined or null to object
This is the code I used:
<div class="kolorek" onclick="changeColor('34495e');" style="background-color:#34495e;"></div>
function changeColor(color) {
var block = document.getElementsByClassName('kafelek');
with (block.style) {
backgroundColor = "#" + color;
}
};