Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6703151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:08:15+00:00 2026-05-26T07:08:15+00:00

the html code : <ul id=top10> <li class=test> <div class=first> <a href=#><img src=01.jpg></a> </div>

  • 0

the html code :

<ul id="top10">
 <li class="test">
    <div class="first">
         <a  href="#"><img src="01.jpg"></a>
    </div>
     <div class="last">
 <a href="#">example one</a>
    </div>
</li>

 <li class="test">
    <div class="first">
         <a  href="#"><img src="01.jpg"></a>
    </div>
     <div class="last">
 <a href="#">example one</a>
    </div>
</li>

 <li class="test">
    <div class="first">
         <a  href="#"><img src="01.jpg"></a>
    </div>
     <div class="last">

example one

example one

my jquery code:

$(document).ready(function(){
    $("div.first img").hide();
    $("ul li:first img").show();
    $("#top li").hover(function(){
        $(this).find("img").show();
    });
});

but it doesn’t work.

i want to get: when open the page. the first image is show, the rest are all hidden. when the mouse hovers on one item title in it. it shows its image. all others are hidden.

PS: i am sorry.it’s ok now. i made a mistake to the ID.but i know my jquery code is bad. is there a better way to get it

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:08:16+00:00Added an answer on May 26, 2026 at 7:08 am

    Specify the correct ID: top10 instead of top. Also, your first two lines can be merged using :gt(0):

    $(document).ready(function(){
        $("div.first:gt(0) img").hide(); //Every image after the first (index 0) img
        $("#top10 li").hover(function(){ //top 10
            $(this).find("img").show();
        });
    });
    

    Fiddle: http://jsfiddle.net/BfHwL/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

HTML CODE: <li id=list_id>List_text<img src='image.jpg' id=img_id></li> jQuery Function: $(#list_id).live('click' , function(){ alert('List is clicked');
HTML code: <div id=img-wrapper> <img src=images/1.png title=Picture 1 class=my-img /> <img src=images/2.png title=Picture 2
Html code is: <div id=questions> <ul> <li class=selected><a href=#fly>Fly</a></li> <li><a href=#fly1>Fly 1</a></li> </ul> <div
The HTML code: <ul> <a href='index.php'> <li> <img src='images/icons/home.png' alt='' /> <p>Home</p> </li> </a>
My html code is: <ul class=nav> <li class=nav-one ><span class=righttab activeright>&nbsp;</span><span class=lefttab activeleft>&nbsp;</span><a href=#featured
I've got HTML code that roughly looks like this: <li id=someid-11> <img src=... alt=alt
Html Code: <table> <tr> <td>test</td> </tr> </table> Jquery Code: $(document).ready(function(){ $('table tr:eq(0)').after('<tr><td>bla</td></tr>').css({'color':'red'}); }); ı
html code: <asp:Button runat=server ID=btnTest Text=Test OnClick=btnTest_Click /> Jquery Code: $('[id$=btnTest]').click(function(){ $('[id$=btnTest]').attr('disabled', 'true'); });
HTML code: div id=updatePanel>​ jQuery code: var data=[1, 2, 3, 4, 5, 6, 7,
HTML code: The HTML code is dynamically created. <li> <div class=above>What do I like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.