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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:48:19+00:00 2026-06-12T09:48:19+00:00

Ok, so need a link changed via jquery. The code below works fine but

  • 0

Ok, so need a link changed via jquery. The code below works fine but it acts immediately. I need the link to become active only on the next click, not on the current click. Hope that makes sense?

Any help appreciated.

 $("#m-menu").click(function(){
$("#menu").animate({right: 0}, 500, "easeInOutCirc");
$(this).text($(this).text() == 'HOME' ? 'HOME' : 'HOME');
$(this).attr('href', 'http://backtohomepage.com');
 });


EDIT: Thanks for all the answers guys – its not quite as simple as an every-other-click solution and big apologies for not being clearer first time round. Here’s the source page (I’ve not applied the above .attr code to this in order to better illustrate my requirement): http://joinersart.co.uk/mtest

Basically when the user clicks either the left/right arrows to navigate the gallery, you’ll see the menu bar shrinks. In order to get it back, you click “MENU”. Once its back out again, the “MENU” text, changes to “HOME” and takes on a new function – link to the home page. Of course, if you click the left/right arrows again, it toggles back to “MENU” and changes its function back to expanding the menu bar. So basically this one link has two functions (either as a homepage link – “HOME”, or as a menu bar expander – “MENU”) depending on whether the menu bar is sticking out or tucked in.

When I try to apply the above .attr code, this is what happens – the user clicks the “MENU link and instead of the menu bar expanding, they are immediately taken to the home page. So it activates the link too soon .click function is executed. What I need it to do is to expand the menu bar and change the text from “MENU” to “HOME” first. Only THEN when the user clicks it, do they go to the home page.

  • 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-12T09:48:20+00:00Added an answer on June 12, 2026 at 9:48 am
    $('#m-menu').click(function () {
        // Do the work here
        $(this).unbind('click');
        $(this).click(function () {
              $(this).attr('href', 'http://backtohomepage.com');
        })
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I know that in C you need to link the code to the
I have a DLL generated from Visual Studio 2010, but I need to link
I need to replace link index.php?a=2 ,but if it's have & after a=2 then
I need to know how to link (via a regular href anchor on a
I need change first image in Galleria fullscreen theme ( link ) after Galleria.run().
I need a link in django template which turns into logout if user is
I have a ListView that displays a link button. I need the link button
I use log4cxx logging library. I need to link with its static version to
I need to display link after each comment, when you click that link, a
File: /home/USER/DIR/a http://www.here.is.a.hyper.link.net/ /home/USER/DIR/b http://www.here.is.another.hyper.link.net/ Need to remove all the odd lines in this

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.