Thứ Hai, 19 tháng 8, 2019

Document.Ready() is not working after PostBack

Fixed: https://stackoverflow.com/questions/9586903/document-ready-is-not-working-after-postback

This is an example that worked for me in the past:
<script>
function MyFunction(){ 
    $("#id").text("TESTING");
}
//Calling MyFunction when document is ready (Page loaded first time)
$(document).ready(MyFunction); 

//Calling MyFunction when the page is doing postback (asp.net)
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(MyFunction);
</script>

Không có nhận xét nào:

Đăng nhận xét