I am trying to write a script so that every time a specific button is pressed, I want to send out a warning message in a div tag. I decided to use the fadeTo because my div tag is inside a table and I dont want it to collapse. However, it seems like after the first press, any subsequent press will not work anymore. Does anyone know a workaround for this?
Here’s my warning code:
$("#warning").html("The value is too low!").css('color','red').fadeTo(10000,0);
At the end of the
fadeTo, the element’s opacity is0. To re-start, reset the opacity back to 100, since otherwise it’s trying to animate from0to0, which is…subtle to say the least. 🙂E.g.:
Live example | source (uses one second rather than ten)