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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:45:12+00:00 2026-06-07T06:45:12+00:00

I have a click function where you click on an anchor tag, it changes

  • 0

I have a click function where you click on an anchor tag, it changes the background of that clicked anchor tag and the text in another element on the page. Now when you click on another anchor tag, it should change the text to the second text variable.When a-tag clicked a third time(that is the third anchor tag, I have 3 of them), it should change back to the first text variable again. Here is my example, but can’t seem to get it working. Also, the background does not change opacity as it should, but I think it is because it is in a td tag-see example

http://jsfiddle.net/gGAW5/94/

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-07T06:45:13+00:00Added an answer on June 7, 2026 at 6:45 am

    Working demo http://jsfiddle.net/tB3pP/3/

    I have just used you r code and did minor changes like var = i and i%2

    Behaviour achieved: when you click 1st time its text1 second time its text2 third time its text1 again.

    Hope this helps, Please lemme know if I missed anything,

    code

    $(document).ready(function() {
        var text1 = "My Text 1";
        var text2 = "My Text 2";
        var i = 1;
        $("a").click(function(event) {
    
            i++;
            if (i%2 != 0) {
                $("#myTitle").html(text1);
                $(this).css("opacity", "0,5");
            }else {
                $("#myTitle").html(text2);
                $(this).css("opacity", "0,9");
            }
        });
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an anchor tag with a click event on it $('a').click(function(){ $.ajax({ url:
I have an anchor tag on my page that toggles between active and cancelled
I have an click function that I want to trigger outside of the function
I have the following click event $(.element).click(function() { var idNum = $(this).getID; $('#new-'+idNum).fadeIn(); });
Here is my problem: I have a large anchor tag that links to one
I'm working with jquery. I have an anchor tag that is generated dynamically in
I have a jquery which has a click event, when any anchor tag is
I have an anchor tag with class .disable and script that toggles it to
I have this inline JS call to a function inside an anchor tag and
I have click events set up like this: $('.dialogLink') .click(function () { dialog(this); return

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.