Learn how to handle the browser events and the state of the document for loading, interactive, and complete Different readyState of a document The current state of the document can be accessed using readyState property of the document object. document.readyState tells us the status of the page load. There are 3 different possible states: loading — The document is …
Tag Archives: Dom
Essential DOM Operations with JavaScript
Learn about some basic but essential DOM methods in JavaScript Image by Pankaj Patel from Unsplash The below code is what we’ll use to access and manipulate with our JavaScript DOM methods: <div id=”parent”> <div class=”child one”> < /div> <div class=”child children second”> < /div> <div class=”child third”> < /div></div> Select and element by id. It …
Remove All children đź‘¶ of the node in Javascript.
Learn how to delete all the nodes inside a div or any node in Javascript. You can do it in three ways 1 . Set the node innerHTML as empty-string(“”). var node = document.getElementById(‘parent’); node.innerHTML = “”; This method removes all the text and nodes inside the parent node. If you need to delete only the …
Continue reading “Remove All children đź‘¶ of the node in Javascript.”