After postback my JavaScript function doesn't work in ASP.NET

It is because of updatepanel partial postbacks. here is what you need to do.

function pageLoad(sender, args)
{
  $(document).ready(function(){   

   // put all your javascript functions here 

  });
}

I had the same issue and it worked for me. I hope it helps you too.


Since you're using an UpdatePanel, the part of the DOM that you've attached your event handler to is getting dropped and recreated after the postback. This has the effect of removing any event handlers that were attached by jQuery when the page first loaded.

When you postback only part of the page, the jQuery $(function() {}); doesn't fire again, so your handlers never get reattached.

Here's a related question that shows how to resubscribe your events when the UpdatePanel refreshes.


It is because of updatepannel used. Following code is working fine. Just put your jquery code inside the pageLoad event like below

function pageLoad(sender, args) {
     $(document).ready(function () {....}
}