I’m changing the value of a div when a user clicks on a control and I’m writing this:
$('#MyDiv').html(TheText);
$('#MyDiv').hide().fadeIn(1000);
The problem is that if the user clicks repeatedly on the control that triggers this code, MyDiv eventually disappears. I tried adding .stop() like this:
$('#MyDiv').stop().hide().fadeIn(1000);
but overall, the MyDiv still disappears.
What do I need to change?
Thanks.
It’s a problem with the combination of
fadeIn()andstop(). The solution is to usefadeTo()and set theopacityproperty of a value of1.Live example: http://jsfiddle.net/NhSh6/1/