Click here to Skip to main content
15,888,351 members
Articles / Web Development / ASP.NET
Tip/Trick

Disable Label after some amount of time

Rate me:
Please Sign up or sign in to vote.
4.86/5 (4 votes)
16 Jan 2012CPOL 24.6K   5   1
Disable Label after some amount of time
Generally in some applications, we use labels to display error message. But even when some operations are done, the label text will be displayed what we initially show.I would like to show how we can disable label after some amount of time using Jquery.

XML
<script type="text/javascript" src="JScript.js"></script>

    <script type="text/javascript">
        $(document).ready(function() {
        $('#<%= Label1.ClientID %>').fadeOut(1500, function() {
                $(this).html(""); //reset the label after fadeout
            });
        });
    </script>


Drag and drop a label on to the form:

<asp:Label ID="Label1" runat="server" />


Download Jquery 1.7 that was required from here:

http://docs.jquery.com/Downloading_jQuery[^]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
India India
I am working as a Software engineer. Web development in Asp.Net with C#, WinForms and MS sql server are the experience tools that I have had for the past 3 years. Yet to work on WCF, WPF, Silverlight and other latest ones.

Comments and Discussions

 
GeneralDisable or disappear?? Pin
jaydev260517-Jan-12 17:04
jaydev260517-Jan-12 17:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.