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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:54:49+00:00 2026-05-23T11:54:49+00:00

Hi Folks, Please help me to fix this : Suppose we call the same

  • 0

Hi Folks,
Please help me to fix this : Suppose we call the same javascript function from anchors but with different parameter

<a id="edit1" onclick="foo(1)"></a> 
<a id="edit2" onclick="foo(2)"></a>

function foo(id)
{
// let's say the code here hide the clicked anchor and show a new anchor with cancel-edit id 
}

The scenario :

  • I clicked in the first anchor – The first anchor replaced with a new anchor :
  • How can i disable the function, so when i click in the second anchor it does nothng.
  • Now suppose i clicked in the anchor with the id cancel-edit it will pull back the anchor with the id edit1 and reactivate the foo function so when i reclick in the second anchor it will execute again the foo function…

i hope it’s clear :X !
Thanks in advance.

  • 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-23T11:54:50+00:00Added an answer on May 23, 2026 at 11:54 am

    If you want to disable it for all the elements after one is clicked, you could just set a flag:

    var enabled = true;
    function foo(id) {
        if( enabled ) {
            // run your code
            enabled = false;
        }
    }
    

    It will continue to run, but the code in the if statement will not after the first click.

    function stop() {
    
        // replace the original anchor
    
        enabled = true; // enable the "foo" handler
    
    }
    

    When the new anchor with stop() is clicked, you replace it with the original anchor, and set enabled to true so that foo() will work again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

yes, this is a homework-type question but could you please help me out? In
Hi folks would really appreciate your help in answering this rather involved question. Please
This is a dupe from SuperUser.com . Folks over there weren't smart enough or
Folks, Please does anyone know how to show a Form from an otherwise invisible
This should be a pretty straightforward classes and interfaces question, but please bear with
I am fighting this thing and cannot figure it out... can someone please help.
Hey folks, this question can't be too complicated. Please provide a solution to at
I know this might be a no-brainer, but please read on. I also know
Folks, is there a collection of gotchas where Numpy differs from python, points that
Folks, I'm tryning to extract data from web page using C#.. for the moment

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.