Skip to content
Advertisement

Why is this JavaScript not working on my website? [closed]

In summary, I’m trying to hide the text next to an image when the web page loads and then display the text when the user hovers over the corresponding image.

I can’t seem to get it to display the text. Here’s the code:

JavaScript

This is the code for the image and text.

JavaScript

CSS.

JavaScript

JavaScript.

I’ve tried a couple different things but I can’t seem to get it to work. Thanks for any help.

Advertisement

Answer

ID should be Id in your function.

JavaScript

If you want it to be hidden again when you stop hovering, you will need another function for the onmouseout event.

JavaScript

A simpler solution to this would be to use CSS :hover

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement