I have server side button. First time jquery is working fine but next time jQuery not wroking. I am using jQuery inside Update Panel.
Below is my Jquery code.
Your initialization will run only on document ready (not on postback). Since you place your control inside UpdatePanel, anything will updated after postback.
Try with the below suggestion
You need to recreate the Jquery Codes on postbacks like given below
<script type="text/javascript">
$(document).ready(function() {
//jquery code
});
var parameter = Sys.WebForms.PageRequestManager.getInstance();
parameter.add_endRequest(function() {
//jquery code again for working after postback
});
</script>
this is the solution got once i got the same issue and worked fine for me..check
Updated:
If above code give error like Sys undefined
then try below code.
<script type="text/javascript">
$(document).ready(function () {
//jquery code
var parameter = Sys.WebForms.PageRequestManager.getInstance();
parameter.add_endRequest(function () {
//jquery code again for working after postback
});
});
</script>
Change it from:
$('.ClassName').click(function(e) {
/////
});
to:
$(document).on("click", ".ClassName", function (e) {
/////
});