Thursday, August 7, 2014

Jquery Is not working After Postback

use the following code:

<script type="text/javascript">
        //On UpdatePanel Refresh
        var prm = Sys.WebForms.PageRequestManager.getInstance();
        if (prm != null) {
            prm.add_endRequest(function (sender, e) {
                if (sender._postBackSettings.panelsToUpdate != null) {
                    $("#ContentPlaceHolder1_txtDownPayment").blur(function () {                       
                        var ttl = $("#ContentPlaceHolder1_txtPrice").val();
                        var booking = $("#ContentPlaceHolder1_txtBookingAmount").val();
                        var downPayment = $("#ContentPlaceHolder1_txtDownPayment").val();

                        var remain = ttl - booking - downPayment;

                        $("#ContentPlaceHolder1_txtRemaingAmount").val(remain);                      
                    });
                }
            });
        };
    
    </script>