How do I hide this modal after 5 seconds?

I’ve tried the code below but it doesn’t seem to work well. Please help!!!
I’m trying to get the modal to popup with an onclick event as it normally would but then I want it to disappear after about 5 seconds and hide the ability to allow the user from making it hide.

<html xmlns="">
<title>jQuery Hide DIV Elements after 10 seconds</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
$(function() {
setTimeout(function() { $("#testdiv").fadeOut(1500); }, 5000)
$('#btnclick').click(function() {
setTimeout(function() { $("#testdiv").fadeOut(1500); }, 5000)
<style type="text/css">
border: 2px solid Red;
color: #008000;
padding: 10px;
width: 400px;
<input type="button" id="btnclick" value="Show DIV" />
<div class="content" id="testdiv" class="">
Hi, Welcome to
It will disappear in 4 seconds!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.