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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:55:59+00:00 2026-06-17T15:55:59+00:00

I need to disable anchor tag using button click event. I handled both server-side

  • 0

I need to disable anchor tag using button click event. I handled both server-side and client-side events for my requirement. I modified the ‘href’ attribute in client-side click event as follows.

[ASPX]

 <asp:Button ID="Button1" runat="server" Text="Disable" OnClick="disable"  CausesValidation="false" OnClientClick="disable();"  />

[Script]

     function disable() {
        $('a.ClassName').attr("href", "#")
    }

It gets set properly. But after the server-side process, anchor tag again sets with the old href attributes. How to resolve this?

  • 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-17T15:56:00+00:00Added an answer on June 17, 2026 at 3:56 pm

    When you PostBack to the server, a fresh page is rendered.

    Any changes you made via javascript will be lost.

    You should detect the condition(button being pressed earlier), at server side and make the necessary changes to url server side too.

    You can store this state change in a hidden input and get it at server side.

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

Sidebar

Related Questions

I am using the following code to disable the click event for anchor tags:
I need to disable the click-event for a button in Android. Just as a
I need to disable client-side validation for a form on a single view. How
I have an anchor tag that has a jQuery click event linked to it.
I have an anchor which is using jQuery .click event to start a few
OK, I have two HTML select elements and a button. I need to disable
Possible Duplicate: How to enable or disable an anchor using jQuery? I've got an
Need to disable already selected options in select box using jQuery. I'd like it
I need to disable right-click on a hyperlink which is in a span. I
I need to disable/not show a Change Install Location button in installer. How do

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.