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 8284105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:58:30+00:00 2026-06-08T10:58:30+00:00

$(.gl).hover(function() { $(‘select[name=’ + $(this).attr(‘name’) + ‘]’).removeClass(gl).addClass(glHover);//Occurs when hovering over }, function(){ //Occurs when

  • 0
        $(".gl").hover(function() {
    $('select[name="' + $(this).attr('name') + '"]').removeClass("gl").addClass("glHover");//Occurs when hovering over
    }, function(){  
        //Occurs when hover is done
    $('select[name="' + $(this).attr('name') + '"]').removeClass("glHover").addClass("gl");
    });

This is my code, basically when someone hovers over any class that is gl, it needs to find all elements with the name matching its own name, this is not working for me though and I’m pretty new to jquery so I’m not sure how to pull this off

Edited the code above, now its still not working, this is why my html looks like(Approx):

<table><tr>
<td class='gl' name='07/25'></td>
</td></table>

Update

$('td.gl').hover(function() {
$('select[name="'+ $(this).data('name') +'"]').toggleClass('gl glHover');
});

and

<td class='gl' data-name='07/18'></td>

Still not working

  • 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-08T10:58:31+00:00Added an answer on June 8, 2026 at 10:58 am

    Try:

    $(".gl").hover(function() 
        $('select[name="' + $(this).attr('name') + '"]').removeClass("gl").addClass("glHover"); 
    }, function(){
        $('select[name="' + $(this).attr('name') + '"]').removeClass("glHover").addClass("gl"); 
    });
    

    Your element declaration was invalid as you were missing a + for concatenation, which in this case is for substituting the element’s name attribute, and your quotes are incorrect. I switched to single quotes since you are using double-quotes for the name attribute and the syntax was invalid.

    Update: It seems that you want to select any element type with a name corresponding to the name of the hovered element. Currently the usage of select[...] looks for a select element. I would suggest you use a class attribute with a value for the corresponding name to link your elements together and then you can reference those elements with a class that represents that name attribute..

    In this case try the following:

    $(".gl").hover(function() 
        $('.' + this.name).removeClass("gl").addClass("glHover"); 
    }, function(){
        $('.' + this.name).removeClass("glHover").addClass("gl"); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$(document).ready(function () { $(#divHeader)) { $(this).hover(function () { $(this).find('#edit').show(); $(this).find('#spandate').removeClass(datetime); $(this).find('#spandate').addClass(edit); }, function ()
I have the following JQuery: $(document).ready(function () { $('tr').hover(function () { $(this).children().addClass(color2); $(this).children().removeClass(color1); });
here is my old code which works: $('.logo').hover(function(){ $(this).addClass('animated swing')}, function(){$(this).removeClass('animated swing') }); here
say you have this code: $(#sub_nav_home1).hover(function () { $(#homepage).removeClass(); $(#homepage).addClass(homepage1); }); $(#sub_nav_home2).hover(function () {
I'm using hover() as suggested in the documentation: $(#div).hover( function(){$(this).addClass('cie_hover');}, function(){$(this).removeClass('cie_hover') ;} ); Is
code: $('.featured').hover( function() { $(this).addClass('active'); $('img',this).fadeTo('slow', 0.5, function() {}) }, function() { $(this).removeClass('active'); $('img',this).fadeTo('slow',
I have the following jQuery: $(#toolbar).hover(function () { $(.logo).fadeOut(slow, function () { $(this).addClass(logohover) $(this).parent().addClass(logohover).fadeIn(slow,
I'm now doing something like : $img.hover(function(){$(this).attr('src','1.jpg')},function(){$(this).attr('src','2.jpg')}); Which is not smooth,because it takes quite
$('img.questSign').hover( function() { $('img.questSign').attr('src', '/media/quest-sign-small-hover.png'); }, function(){ $('img.questSign').attr('src', '/media/quest-sign-small.png'); }); This code works quite
I've done some easy .hover(function() statement in jQuery. When i hover over a text

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.