Create the Main JavaScript Module and Insert Other Modules Tutorial

Published :
Author :
Adam Khoury
Learn to take a modular approach to your reusable external JavaScript library of scripts. In this lesson we create the main JavaScript module which is the file that will be called into every page of the web site. UPDATE 12/8/2022: Now you can just write the element id in your JavaScript code without first using getElementById(). Modern browsers now automatically create an object reference for each element in the document that has an id assigned. You can reference the element id as an object straight away. Example: button1.style.display = "none"; ( getElementById() is not needed for modern browsers ) // Make this function external like I did in the video function _(x){ return document.getElementById(x); } // And all over the site from now on you can get html elements by their id by simply using _("div1").innerHTML = "Hello World"; ajax module: Ajax-Framework-Tutorial-Custom-Module-Programming autoscroll: Smooth-Auto-Scroll-Tutorial fade and expand/retract: Trigger-CSS-Transitions-to-Control-Animations