Sorry to bother with this kind of questions, i tried to look out for a solution to my problem but couldn't find any that applied.
I'm trying to toggle a class on an element by clicking on another element, by doing this:
var myCanvas = document.querySelector('main');
function btOne() {
myCanvas.classList.toggle("one");
}
I defined the div i wanted to add a class to and defined the function.
<main></main>
<div class="pickers">
<div class="pick one" onclick="btOne()"></div>
</div>
It says the function is not defined when i click the div. I can't seem to figure out what's wrong with it. Check my DEMO to really see what's going on.
On a side note, I'm trying not to use libraries such as jQuery.