Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67497

jQuery hide all images except first one in a generic way

$
0
0

I want to show only the first image and hide others, this is how HTML looks like:

<div class="slider-image">
            <img src="html.png" alt="Html" />
            <img src="css.png" alt="Css" />
            <img src="jquery.png" alt="jQuery" />
        </div>

In this example I want to see html.png but I have to consider more images so I have to find a generic solution. I tried with:

$("div.slider-image").hide();
$("div.slider-image").eq(0).show();

but it shows every image, can someone help me?


Viewing all articles
Browse latest Browse all 67497

Trending Articles