In the jquery library, there is a method setTimeout(). You can use it to hide a div in 10 seconds, 3 seconds, or 5 seconds from the page. You can use the hide() method to hide a div or the remove() method to remove a div from the page. Instead of this, you can use a CSS stylesheet to hide a div block in just 10, 3, or 5 seconds.
Remove a div from the page in 5 seconds using setTimeout() and remove() methods -
<!DOCTYPE html>
<html>
<head>
<title>Remove a div after page loads in JS jQuery</title>
<script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
<script type="text/javascript">
setTimeout(function(){
$(".ad").remove();
}, 5000);
</script>
</head>
<body>
<div class="ad">Your ad code. Wait for 5 seconds..</div>
</body>
</html>
Hide a div in 10 seconds using a CSS stylesheet-
You can hide a div using CSS class only using the addClass() method-
<!DOCTYPE html>
<html>
<head>
<title>Hide a div using CSS stylesheet in 10 seconds</title>
<style>
.ad_hide{
display: none;
}
</style>
<script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
<script type="text/javascript">
setTimeout(function(){
$(".ad").addClass('ad_hide');
}, 10000);
</script>
</head>
<body>
<div class="ad">Your ad code. Wait for 10 seconds..</div>
</body>
</html>
If you don't want to use the addClass() method then you can use CSS() method to hide a div.
$(".ad").css({'display': 'none'});
You can use one any example to hide any div with an id name and class name in 10 seconds, 3 seconds, or 5 seconds.
Reference -
https://developer.mozilla.org/en-US/docs/Web/API/setTimeout
https://api.jquery.com/hide/
https://api.jquery.com/remove/