Page 1 of 1
Automatically close " Success: Your coupon discount has been applied" ALERT after 5 seconds?
Posted: Wed May 22, 2024 10:51 am
by supak111
Is there any way to automatically close the " Success: Your coupon discount has been applied" coupon added to cart ALERT after 5 seconds?
Re: Automatically close " Success: Your coupon discount has been applied" ALERT after 5 seconds?
Posted: Wed May 22, 2024 8:12 pm
by ADD Creative
You would need to add something like the following. You may need to add .alert-success to the selector if you only want to close success messages.
Code: Select all
setInterval(function() {
$('.alert-dismissible').alert('close');
}, 5000);
Re: Automatically close " Success: Your coupon discount has been applied" ALERT after 5 seconds?
Posted: Thu May 23, 2024 12:37 am
by supak111
Thanks for the help. Actually ended up using this and it seems to work for successful alert, but not for Warning alerts even though they both use .alert class
Code: Select all
setTimeout(function(){
$('.alert').fadeOut()
}, 2000);
Re: Automatically close " Success: Your coupon discount has been applied" ALERT after 5 seconds?
Posted: Thu May 23, 2024 6:04 am
by straightlight
supak111 wrote: ↑Thu May 23, 2024 12:37 am
Thanks for the help. Actually ended up using this and it seems to work for successful alert, but not for Warrning alerts even though they both use .alert class
Code: Select all
setTimeout(function(){
$('.alert').fadeOut()
}, 2000);
Now that the issue has been solved, please add: [SOLVED] at the beginning of the subject line on your first post.
Re: Automatically close " Success: Your coupon discount has been applied" ALERT after 5 seconds?
Posted: Thu May 23, 2024 10:10 am
by supak111
Well it's only 50% solved. Its not working on Warning alerts
Re: Automatically close " Success: Your coupon discount has been applied" ALERT after 5 seconds?
Posted: Fri May 24, 2024 11:53 pm
by straightlight
supak111 wrote: ↑Thu May 23, 2024 10:10 am
Well it's only 50% solved. Its not working on Warning alerts
What's the code you used for warning alerts?
Have you tried with:
alert alert-warning ?