Alternative of document ready in pure javascript. In jquery we use document ready just using javascript library Alternative of document ready in pure javascript. In jquery we use document ready just using javascript library and using the code $(document).ready(function(){}); But if we are not using the javascript library how to do any thing on document ready.The be

<html lang="en">
<title>Alternative of document ready in pure javascript</title>
<head>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
 document.getElementById("msg").innerHTML="Welcome to my site";
 });
</script>
</head>
<body>
<div id="msg"></div>
</body>
</html>

Leave comment

Your email address will not be published. Required fields are marked with *.