jquery - How to hide flash message after few seconds? -
in application user can post challenge other user. after successful posting challenge displaying 1 flash message same. want hide message after few seconds. wrote following code :
$(document).ready(function(){ settimeout(function() { $("#successmessage").hide('blind', {}, 500) }, 5000); }); <div id="successmessage" style="text-align:center; width:100%"> <font color="green" > <%if flash[:alert]=="your challenge posted successfully."%> <h4><%= flash[:alert] if flash[:alert].present? %> <%end%> </font> </div>
but code not hiding div "successmessage".
you can try :
settimeout(function() { $('#successmessage').fadeout('fast'); }, 30000); // <-- time in milliseconds
if used div hide after 30 sec.i tried 1 , worked me.
Comments
Post a Comment