Two questions…
I have a set of DIVS with some code intended to change the colour of the clicked DIV and reset the others to their default. This works nicely… but the background colours are specified inside the javascript code. When I tried to use CSS classes, things didn’t work as they should. How can I get this second version to work so that it uses css classes to specify the colours rather than the javascript.
My second question relates to the
.parent()
part of the code and what that actually does in this context?
Any help is appreciated.
Try this:
http://jsfiddle.net/HNXjQ/4/
HTML:
CSS:
JS: