• 971-553421531
  • info@efaschool.com
  • Dubai(United Arab Emirates)

Master the DOMContentLoaded Event in JavaScript

Master the DOMContentLoaded Event in JavaScript The DOMContentLoaded event is a JavaScript event that fires when the document has been loaded and parsed, but befor any images or stylesheets have finished loading. This means that you can use the DOMContentLoaded event to perform actions that depend on the DOM being loaded, such as adding event Listeners to elements or dynamically…

Master the classList Property in JavaScript

Master the classList Property in JavaScript What is classList in JavaScript? The clasList property in JavaScript is a read-only property of the element interface that returns live DOMTokenList object representing the class attributes of the element The clasList property is a convenient alternative to accessing an element’s list of classes as a space delimited string via the className property. The…

JavaScript CurrentTarget Property

JavaScript CurrentTarget Property The currentTarget property in javascript is read-only property of the Event interface that identifies the current target for the Event, as the event traverses the DOM. It always reffers to the element to which the event handler has been attached, as opposed to the target property, which identifies the element on which the event occurred and which…

JavaScript addEventListener( )

javaScript addEventListener( ) The addEventListener( ) method in javaScript is used to attach an event handler to an element. An event handler is a function that is called when a certain event occures, such as mouseclick, or keypress. The addEventListener( ) method takes three arguments: The first argument is the name of the event. This is the name of the…

JavaScript forEach( )

JavaScript forEach() The forEach() method in javascript is an iterative method that calls a provided callback function once for each array element in ascending index order. The callback function is passed three arguments: 1 The current element. 2 the index of the current element3the array itself The syntax for the forEach() method is: array.forEach(callbackfn); where array is the array to…

JavaScript querySelectorAll()

JavaScript querySelectorAll() The querySelectorAll() method in JavaScript is used to select all elements that match a CSS selector. The syntax for the querySelectorAll() method is: document.querySelectorAll(selector);  where selector is a CSS selector that specifies the elements to select. For example, the following code will select all button elements with class = “btn”: const elements = document.querySelectorAll(‘.btn’); The querySelectorAll() method returns…

JavaScript querySelector() Method

JavaScript querySelector() The querySelector() method in JavaScript is used to select an element using CSS selectors. The syntax for the querySelector() method is: document.querySelector(selector); where selector is a CSS selector that specifies the element to select. For example, the following code will select the element with the id=”value”: const value = document.querySelector(“#value”);  The querySelector() method returns an Element object if…

javascript Counter Programming

javascript Counter Programming Define the variable named count and set the initial value to zero let count = 0; const value = document.querySelector(“#value”);  In the above statements, we have defined a variables named value. The value of the value variable is set/initialized as the HTML element with ID value. such as <span id=”value”>0</span> const btns = document.querySelectorAll(“.btns”);  In the above…

Color Flipper JavaScript Programming

Color Flipper Excellent JavaScript Color Flipper Tutorial Directory Structure Create folder in your desired directory named setup In the setup folder create files like index.html, app.js, style.css Creating index.html File Download The Source File Color Flipper JavaScript Programming 1 We have created an object using an object literal way and it is containing all the hexadecimal digits as object members….