I´m just learning Prototype and I´m having a hard time finding good documentation/tutorials, I think that this problem should be easy to do, but I just can’t get it to work. I want to have hover effects on a div until its clicked on, then after its clicked on I want it to have normal behaviour. This is what I have so far:
document.observe("dom:loaded", function() {
$("evtTarget").observe("mouseover", highlight);
$("evtTarget").observe("mouseout", highlight);
$("evtTarget").observe("click", function(evt) {
$("evtTarget").stopObserving("mouseover", highlight);
$("evtTarget").stopObserving("mouseout", highlight);
});
});
function highlight(evt) {
$("evtTarget").toggleClassName("highlighted");
}
When I use this code, my div doesn´t highlight, but I can´t figure out what I´ve done wrong. Any help or suggestions would be greatly appreciated!!!
Thanks!
edit: here´s my jsfiddle version:
http://jsfiddle.net/jaFuP/1/
Works just fine for me. The problem is likely elsewhere.
evtTarget?<script src="path/to/prototype.js></script>)?highlightedclass with styles other than what the element with idevtTargetalready has?