I’m trying to trigger a javascript onMouseOver event without having the onMouseOver attribute on everyone of my anchor attributes. In reality I want to display some other anchors when the user mouses over an element, but I can’t even get an alert to work. I keep getting the error of:
Uncaught TypeError: Cannot call method 'getElementsByTagName' of null
Which doesn’t make sense to me because if I alert out the getElementById() I end up with a DIV element, which it should then get all the anchor tags inside that div element… Not sure what I am missing.
JSFiddle Link: http://jsfiddle.net/NfTtq/
Also note I am doing this Javascript not JQuery :S
You are trying to find the element before it exists, you can do this in jsfiddle by selecting
onDomReadyfrom the left instead ofno wrap (head)The other problem is
onMouseOver, javascript is case sensitive so onlyonmouseoverwill work.Here is updated jsfiddle:
http://jsfiddle.net/NfTtq/1/