Hi
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?)
Hi
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.
window.setTimeout( hideTagFn, 5000);
function hideTagFn(){
$('#someElementId').hide();
}