I am writing a page using JavaScript, and I have 4 divs, all of which are from the same class. Each div has a function that changes the styles of the other divs (border colour and background colour, for example). The problem is that the last div does not get affected by the functions of the divs above it, because it was not “assigned” yet. Is there any way to fix this?
Share
Make sure you run your code when the window has completely loaded.