How to Use Window.onload() Event

Any DOM manipulation code which depends on the DOM elements located at the head section of the html page, this code will be executed first before the DOM is fully ready. However error may occurs. Therefore, it is required to put the codes inside a callback function which will be fire when the DOM is …

Continue reading How to Use Window.onload() Event

Why does jQuery or a DOM method could not find the element?

As script executed line by line, they are only executed when they are added into the DOM. The order matters. This mean the script cant find the element which written later below as it is not added into the DOM yet. Example: The result for first document.getElementById is null. However, there is value for the …

Continue reading Why does jQuery or a DOM method could not find the element?