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

  • SEARCH
  • Home
  • 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 7867123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:37:27+00:00 2026-06-03T00:37:27+00:00

The jquery code below does exactly what I want it to do on hover.

  • 0

The jquery code below does exactly what I want it to do on hover. However, I need it to work in the following way:

if a user hovers over #altimgX (for example) the black border appears. I want this border to stay until ‘#altimgY’ is hovered; at that time, I want to remove the border from #altimgX.

I tried using ‘mouseleave’ but this does not solve my problem since I want the current #altimg border to stay until another #altimg element is hovered.

$("#altimg0, #altimg1, #altimg2, #altimg3, #altimg4, #altimg5").hover(function(){
        $(this).css('border', '3px solid black');
});     

HTML code snippet

<div id="altimg0" style="height:70px; width:70px;"> SOME IMAGE </div>
<div id="altimg1" style="height:70px; width:70px;"> SOME IMAGE </div>
<div id="altimg2" style="height:70px; width:70px;"> SOME IMAGE </div>
<div id="altimg3" style="height:70px; width:70px;"> SOME IMAGE </div>
<div id="altimg4" style="height:70px; width:70px;"> SOME IMAGE </div>
<div id="altimg5" style="height:70px; width:70px;"> SOME IMAGE </div>

I appreciate any help any help in this regard.

thank you

  • 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-06-03T00:37:28+00:00Added an answer on June 3, 2026 at 12:37 am
    var altimgs = $("#altimg0, #altimg1, #altimg2, #altimg3, #altimg4, #altimg5");
    
    altimgs.hover(function() {
        altimgs.css('border-width', '0');
        $(this).css('border', '3px solid black'); 
    });
    

    In the hover function for each of the elements, you just have to remove the borders first, then only set it for the one you want.

    Also, a fiddle: http://jsfiddle.net/EYgpj/

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

Sidebar

Related Questions

Let's say we have the following JavaScript/jQuery code below function createElement(i, value) { return
Possible Duplicate: In jQuery, what does $.fn. mean? Can someone explain the code below
I'm using the jQuery code below to launch an overlay div and it works
I am having a very specific problem in JQuery The code below is used
So I wrote the code below: jQuery('#contentWrapper').delegate(.addButton, click, function(){ addRow(jQuery(this)); }); function addRow(thisButton){ var
I am using the below jquery code to call a ajax function in my
The below HTML/CSS/Javascript (jQuery) code displays the #makes select box. Selecting an option displays
I have this javascript code below that uses jquery, it is suppoed to be
I am using jquery to create a custom dropdown with the code below. I
I am getting JQUERY undefined error. Do you have any idea (code below). <%@

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.