• 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

Read More »

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

Read More »

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

Read More »

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

Read More »

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

Read More »

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

Read More »