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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:09:27+00:00 2026-05-26T21:09:27+00:00

I am assigning some text to Label after button click as follows: protected void

  • 0

I am assigning some text to Label after button click as follows:

protected void Button1_Click(object sender, EventArgs e)
{
    Label1.Text = "Hello";
}

After some amount of time, say 30seconds, I would like to clear the Label text.
Can any one help me?
I tried the following script, but it doesn’t work for me.

$(document).ready(function() {
    $('#Label1').fadeOut(3000, function() {
        $(this).html(""); //reset the label after fadeout
    });
});

My design

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        $(document).ready(function() {
        $('#<%= myLabel.ClientID %>').fadeOut(3000, function() {
                $(this).html(""); //reset the label after fadeout
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Label id="myLabel" runat="server"></asp:Label>
        <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
    </div>
    </form>
</body>
</html>
  • 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-26T21:09:28+00:00Added an answer on May 26, 2026 at 9:09 pm

    In order to run some code after specified time you need to wrap the code in ready handler in

    setTimeout(code, timeInMsAfterWitchToRunCode)
    

    call. What you are doing is fading out immediately over a 3 seconds time. 3000ms that you are passing is parameter to fadeOut function telling it how long fading out should take.

    Here you have working example:

    http://jsfiddle.net/VPrEZ/3/

    Note that in case of ASP.NET app you should use:

    $('#<%= Label1.ClientID %>')
    

    to select label. That is because you don’t know the id of the control until runtime when control has runat=”server” attribute set.

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

Sidebar

Related Questions

I have some input text fields and I assigning id parent_number and row_number dynamically
I'm having some issues aligning the header text of a datagrid. I'm using an
I am assigning some data to html objects by a jquery I'm creating, the
Need some help assigning a mouseover event to display some icons that start out
I'm trying to set some values to my NSMutableDictionary inside a loop and assigning
I am assigning the unique ids to the div by selecting their class $(#addTab).live('click',
I am assigning a value to .Text of a textbox retrieved from a database
I need to write some fixed-width font (i.e Courier New or Consolas) text to
For example, I have this HTML structure: <ul> <li><a class=ac_list_a>some text</a></li> <li><a class=ac_list_a>some text</a></li>
I need some text to appear below embedded media (in this case a video),

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.