Skip to content
Advertisement

Having trouble making an image disappear when using onmouseover event on a button

I’m having trouble making an image disappear while using an onmouseover event not on it, but on a button element. I need it to appear while onmouseover and disappear while not onmouseover. Heres my code:

JavaScript

This is the javascript to make it appear on mouseover, and the html is

JavaScript

The onmouseout for all of these just makes the background orange but I want it to make the image corresponding to it disappear, which I’m having trouble with since you cant assign multiple ID’s to an element. A jquery solution would work too, and so would one in angular. https://plnkr.co/edit/WwpzOkipsiCrbgbpXbd4?p=preview heres the pnlkr link, stetch the html portion out to see the whole thing too.

Advertisement

Answer

Here is a simple example using JQuery:

https://jsfiddle.net/ztuf96dg/4/

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