I am wondering how can I hide/remove a tag after a certain amount of time. Is there some built in thing or do I do use threading(if javascript can do this?)
You don't even need jQuery for the "5 seconds" part: JavaScript's built-in setTimeout
function will do the trick. Incorporating jQuery for the DOM manipulation, you get:
setTimeout(function() {
$("#the-tag-you-want-to-remove").remove();
}, 5000);
Here the 5000
represents 5000 milliseconds, or 5 seconds. You can pass setTimeout
an existing function or (as in this case) an anonymous function.
Try to use .delay() function
http://api.jquery.com/delay/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With