65.9K
CodeProject is changing. Read more.
Home

Disable Label after some amount of time

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.86/5 (4 votes)

Jan 16, 2012

CPOL
viewsIcon

24911

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.
<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[^]