Wednesday, April 1, 2009

[jQuery] Problem with .click even fired as many times the page refreshes

I have the followin code in my html

<script type="text/javascript">
jQuery(function() {
jQuery('#slickbox').hide('fast');

jQuery('#slick-toggle').click(function() {
jQuery('#slickbox').toggle('blind',350);
return false;
});

});
</script>


The problem is that when the page is refreshed due to an AJAX postback
the function is called again. This is allright. But the main problem
is that when I click the slick-toggle link, it is fired as many times
the page has been refreshed due to AJAX. i.e. if we have 5 ajax
postback, the slickbox.toggle function will be fired for 5 times and
so on. I dont know the solution of it.

Thanks

No comments: