asp.net updatepanel 导致JS不能加载,而无法使用的解决方法

时间:2022-04-07 17:04:34

代码如下:


<script type="text/javascript" language="javascript">
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_endRequest(function () {
        // re-bind your jquery events here  
        $(document).ready(function () {

            //begin 
            var span = $("input[id*='txtSpan']");
            span.focusout(function () { 
                var greaterthenzero = (span.val() == 0);
                if (span.val() == 0) {
                    $("#spRule").show();
                    $("input[id*='btnSave']").attr("disabled","disabled");
                }
                else {
                    $("#spRule").hide();
                    $("input[id*='btnSave']").removeAttr("disabled");
                } 
            });
            //end

        });
    }
 );
</script>