jQuery: how to select and fadeOut an image based on container ID and 'src' attribute

Given the attached HTML, lets say I have a variable such as:

var replaceImage='art/gr_number_1.jpg';

How can I select the image based on its container ID (the DIV) and its 'src' attribute? I tried these two things with no luck:

$('src', removeImage).fadeOut(200);

<div id="question1">
<img class="ranknum" src="art/gr_number_1.jpg" width="200" height="240" border="0" />

Open in new window

Brad BansnerWeb DeveloperAsked:
Who is Participating?

$('#question1 > img[src="'+replaceImage+'"]').fadeOut(200);
Brad BansnerWeb DeveloperAuthor Commented:
I tried that, didn't work. Then removed the > sign, now it works. Should that really be needed?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.