I want to add an event listener to an id which then alters some css. But without using html onchange, I have this (code below) so far. I'm almost certain im using addEventListener wrong.
window.onload = function() {
var checkbox = document.getElementById('no_photo');
alert('win loaded');
checkbox.addEventListener('click', function() {
alert('event triggered');
var photo = document.getElementById('photo_upload');
if(photo.style.display != 'none') {
photo.style.display = 'none';
}
else if(photo.style.display == 'none') {
photo.style.display = 'block';
};
});
}
clickin quotes...checkbox.addEventListener("change",Check your console for errors