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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:55:47+00:00 2026-05-12T17:55:47+00:00

I have a menu with a (links) tags. In Jquery I’m handling click event

  • 0

I have a menu with a (links) tags. In Jquery I’m handling click event at the parts of menu (a) and then show down content block. Everything is ok, but now I want to make possibility have links in content into another parts of menu.

<div id="head_menu">
   <a href="#order">1</a>
   <a href="#portfolio">2</a>
   <a href="#contacts">3</a>
   <a href="#vacancies">4</a>
   <a href="#about">5</a>
</div>

$('#head_menu a').click(function(){
   currentPage = this.href.split( '#' )[1];

   // If content area is already opened - close it
   if( $('#text').is(':visible') )
   {
      $('#text').slideUp();
   }

   $("#inner").load( 'static_page.php?page=' + currentPage, function() {
      $('#text').slideDown();
   });
});

Here I just open content window with need text, when menu is clicked. So, now I want to have a link in content to another menu part:

<div id="inner"><a href="#about">link text</a></div>

Here is JQuery code:

$('#inner a').live( 'click', function() {
 $('#head_menu a[href*=' + document.location.hash + ']').click();
});

And after 1st clicking current content menu is hiding and than showing with the same content, but after 2nd clickin I get that, what I want: new content due to clicked menu is opening. Why does it wrok only after 2nd click?

  • 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-05-12T17:55:48+00:00Added an answer on May 12, 2026 at 5:55 pm

    document.location is changed after the first click (this makes sense when you think about it, as you can use JavaScript to cancel clicks).
    Try something similar to what you did on the other function (assuming it works, and consider moving it to a function – this is duplicated code):

    $('#inner a').live( 'click', function() {
       var target = this.href.split('#')[1];
       $('#head_menu a[href*=' + target  + ']').click();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a horizontal menu bar made up of <li> tags, containing links, so
I have 2 div tags which emulate a drop-down menu. When the outer div
New to jquery. The desire is to show/hide horizontal menu bar items. I have
I am trying to click all links on stackoveflow horizontal menu (Questions, Tags, Users,
In menu.html, I have my menu items(a href links), let's call them, menu_1, menu_2,
I have the following two links in my main menu, and I have some
Scenario: I have an outline where I have links for my menu. Each link
if i have the following links : <a href="#" onclick="return navigateTo(this)" id="menuList:0:menu" class="normalLink"> <span
I have a sliding JS menu that opens when you click the noty_menu link,
I have a menu system where when you click on a link, sub-headings will

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.