I am changing button style when through jQuery when a button is clicked. Below is the code.
<script type="text/javascript">
$(document).ready(function () {
$("#btnDiv .down").click(function () {
$(this).addClass("click");
});
});
Since i have enclosed the #btnDiv in UpdatePanel the above functionality acts only once. What is the reason and a work around for the problem.
When you render your updatePanel, you need to execute those javascript once again, otherwise the former bound event will not be there, after updating.
Take a look at jQuery.on()
If you have a jQuery Version before 1.7, you maybe need to use the
.delegate()or.live()function.So your code could be:
You don't need to render the above code every time you update your panel. Just execute once.