-
Loop Syntax in jQuery
jQuery 3.0 is the most newest version of jQuery. There are many changes in it, but one of the important change
is the syntax of loop using for..of loop.For example earlier we use the syntax shown below:-
var $divelements = $("div");
for (var x=0; x< $divelements.length; x++){
$divelements[x].addClass("dummy");
}Here's the new syntax:-
var $divelements = $("div");
var i = 0;
for(var elm of $divelements) {
elm.addClass("dummy");
}With the help of this new syntax, you will get DOM elements, instead of jQuery collection. You not need to use index to get element, it will be directly accessible to you.
-
This discussion was modified 9 years ago by
Sourabh.
-
This discussion was modified 8 years, 11 months ago by
Forcetalks.
-
This discussion was modified 9 years ago by
Log In to reply.
Popular Salesforce Blogs

FileMaker, Salesforce Integration - Get the Best of Both the Worlds
First things first, why do we need the integration at all? Direct integration between FileMaker and Salesforce allows developers to use the best capabilities of…

How Does Salesforce Marketing Cloud Solve the Marketing Issues of Small Businesses?
With time customer demands are growing, and it becomes an issue for the marketer to maintain the product's branding. This is particularly true for small-scale…

How to Become a Successful Salesforce Developer?
In today's technology-driven world, Salesforce has emerged as a powerful force in the business ecosystem. With its robust customer relationship management (CRM) platform and extensive…
Popular Salesforce Videos
How to Start a Process with Parameters on UiPath Robots from Salesforce Interface
How to start a process with parameters on UiPath Robots from the Salesforce interface. Watch this video and learn. Let us know in the comments…
Salesforce Sales Cloud Training | Sales Cloud In Salesforce | Salesforce Tutorial
This Salesforce Sales Cloud Tutorial will help you understand what is leads home page, how to create contacts, how to create products and all creating…