Avatar of Brad Bansner
Brad Bansner

asked on 

Using jQuery to hide image within div that was moused over

I want to hide the image within this DIV when moused over, but this doesn't seem to be working. Any suggestions?

Thank you!

$('.midbutton1').hover(function(){
      $(this).next('.midbuttonarrow').hide();
});

<div class="midbutton1">
<img class="midbuttonarrow" src="img/gr_midbutton-gray.png" width="10" height="6" border="0" />
</div>

Open in new window

JavaScript

Avatar of undefined
Last Comment
Brad Bansner
Avatar of Ovid Burke
Ovid Burke
Flag of Saint Vincent and the Grenadines image

Try this:

$('.midbutton1').hover(
	function() {
		//$('img', this).hide();
		$(this).children('img').hide();
	},
	function() {
		//$('img', this).show();
		$(this).children('img').show();
	}
);

Open in new window


The lines that are commented out will also work as an alternative.
ASKER CERTIFIED SOLUTION
Avatar of Ovid Burke
Ovid Burke
Flag of Saint Vincent and the Grenadines image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Brad Bansner
Brad Bansner

ASKER

Thanks!
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo