I have code which collects elements with class .colors
var colors = document.querySelectorAll('.colors');
And loop which assigns event to all that elements.
for (var i=0;i<colors.length;i++) {
var color = colors[i];
color.addEventListener('click', remember(color.getAttribute('id')), false);
}
How can I send parameter (in this sample- 'color.getAttribute('id')') to function (in this sample- 'remember') without her initiation?
function remember(color_value) {
localStorage.setItem('color', color_value); }