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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:39:06+00:00 2026-05-14T14:39:06+00:00

Using jquery I have a clicking tab mechanism that are nothing but anchor tags

  • 0

Using jquery I have a clicking tab mechanism that are nothing but anchor tags that return false but call javascript functions to run some events on the page. The problem is I am using jquery to apply an opacity style to the active anchor. and the other sibling anchor get a lesser opacity view. My code looks like this

$("#menutab li a").click(function(){
 $(this).animate({opacity:'1'},1000);
  $(this).siblings().animate({opacity:'.25'},1000);
}

I would think this code would act only on the clicked element and apply that css style to that element and the other style to the other anchor tags except the clicked one. It kind of does that, but also what it does is leave the earlier clicked element to opacity =1, so if I click an element it sets it opacity to 1 and then if I click another one it sets it opacity to 1 while leave the earlier clicked one to 1 also instead of setting it to .25 like the others.

Edit:
I changed the above code to:

$("#menutab ul li").click(function(){
 $(this).children().animate({opacity:'1'},1000);
  $(this).siblings().children().animate({opacity:'.25'},1000);
});

and now I get the desired effect, except that when the first anchor in the list is clicked doesn’t follow the event rules, When the first one is clicked its as if, the click event is not triggered, because no opacity style changes. which I don’t understand.

  • 1 1 Answer
  • 3 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-14T14:39:06+00:00Added an answer on May 14, 2026 at 2:39 pm

    This works perfect for me, even when clicking the first anchor in the list:

    <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
    
    <script type="text/javascript">
    $(document).ready(function() {
        $("#menutab ul li").click(function(){
         $(this).children().animate({opacity:'1'},1000);
          $(this).siblings().children().animate({opacity:'.25'},1000);
        });
    });
    
    </script>   
    <div id="menutab">
        <ul>
            <li><a href="javascript: return false;" >Test1</a></li>
            <li><a href="javascript: return false;" >Test2</a></li>
            <li><a href="javascript: return false;" >Test3</a></li>
            <li><a href="javascript: return false;" >Test4</a></li>
            <li><a href="javascript: return false;" >Test5</a></li>
        </ul>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a slideshow component that I wrote in javascript using jQuery. The slideshow
I have a JQuery (using JQuery 1.4.2) problem that exhibits only in IE8 in
I have some tabs using jQuery UI which work just fine, but I want
I have started using jQuery and rails. I have made a simple form that
I have a function using jQuery function enableField(fieldID) { $(# + fieldID).removeAttr('disabled').focus().select(); } that
I have a sideshow using jQuery Cycle . The way it works is that
Using javascript/jQuery: I have an array with images and I need to display them
I have a link to delete action using Jquery dialog confirm message. Clicking on
I have loaded a page into div using jQuery. But when i refresh the
I have created this combi effect using jquery ui.. http://jsfiddle.net/wnmUj/2/ The problem is that

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.