Answers for "domcontentloaded event"

17

listerner content loaded js

window.addEventListener('DOMContentLoaded', (event) => {
    console.log('DOM fully loaded and parsed');
});
Posted by: Guest on March-21-2020
1

domcontentload event in javascript

<!DOCTYPE html>
<html>

<head>
    <title>JS DOMContentLoaded Event</title>
    <script>
        document.addEventListener('DOMContentLoaded', () => {
            let btn = document.getElementById('btn');
            btn.addEventListener('click', () => {
                // handle the click event
                console.log('clicked');
            });
        });
    </script>
</head>

<body>
    <button id="btn">Click Me!</button>
</body>

</html>
Code language: HTML, XML (xml)
Posted by: Guest on April-12-2021
0

javascript document DOMContentLoaded event

import domloaded from 'domloaded';
domloaded(() => { /* dom is loaded... */ });
Posted by: Guest on July-11-2021

Code answers related to "domcontentloaded event"

Code answers related to "Javascript"

Browse Popular Code Answers by Language