I'm trying to make a basic JS file for my site and this is what it needs to do. I need it to pick out all of the divs with the classname 'program', and and depending on which 'program' was hovered over, perform an action unique to that element. Is this possible, or would I have to move in a more specific step and go to targeting unique IDs or data attributes?
The only thing I have so far is this:
var programs = document.getElementsByClassName('program');
This is to get an 'array-like' list of all 'programs' appearing in the DOM. Then I want to have a hover function that depending on which 'program' was hovered over, program[0], program[1], program[2], or program[3], perform a specific action.
No jQuery please!