What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-17 22:50:04
js on page loaded
//two ways of executing JS code after page is loaded, use "DOMContentLoaded" when able document.addEventListener("DOMContentLoaded", function(){ //dom is fully loaded, but maybe waiting on images & css files }); window.... Add solution -
Javascript 2021-10-17 01:54:07
how to set image width and height dynamically in javascript
document.addEventListener('DOMContentLoaded', function() { var image = document.getElementById("container"); alert(`${image.width} x ${image.height}`); }, false); Add solution -
Javascript 2021-10-15 05:12:08
play background music in jasvascript
<audio src="https://www.bensound.com/bensound-music/bensound-moose.mp3"></audio> <Script> window.addEventListener("DOMContentLoaded", event => { const audio = document.querySelector("audio"); a... Add solution -
Html 2021-10-06 09:14:04
how to find total height of single page page in html
function calculateTotalHeightMinusElement(excludeElementClass) { // Get all child elements of the body tag var bodyChildren = (document.getElementsByTagName('body')[0]).children; var totalHeight = 0; // Loop through the selected elements for (... Add solution