i want to add a div and after 5 seconds remove it. i tried
$("#mainContentTD").prepend("<div style='color: #038a00; padding-bottom:10px;'>Your detailes where sucsesfuly... </div>").delay(5000).remove("this:first-child");
Use noscript tag and put div in it to display when java script is disabled in browser. Show activity on this post. Show activity on this post. The below code worked for me, if you are intending to show the Div for a few seconds...
You can use setTimeout
like this:
setTimeout(function(){
$('#divID').remove();
}, 5000);
The 5000 (ms) means 5 seconds. You should replace divID
with your own div/element id.
You can make sure that the div exists first using length
:
setTimeout(function(){
if ($('#divID').length > 0) {
$('#divID').remove();
}
}, 5000)
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