How to create a fading label in JQuery / ASP.NET after a button press

后端 未结 4 627
面向向阳花
面向向阳花 2021-01-22 13:59

I think that this should be pretty easy but I\'m not quite sure how to wire things up.

I have a page on which the user can define a query. When done, the user enters a

4条回答
  •  天涯浪人
    2021-01-22 14:43

    Here's a low-tech technique that keeps all the script in your page template: add a $(document).ready() function to the page that executes conditionally based on a page-level variable, like this ...

    // In your button's click handler, set this.UserHasClicked to true
    var userHasClicked = '<%= this.UserHasClicked %>' == 'True';
    $(document).ready(function() {
        if(userHasClicked) {
            $(labelSelector).delay(2000).fadeOut(1000);
        }
    });
    

提交回复
热议问题