-
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 10 years, 6 months ago by
Sourabh.
-
This discussion was modified 10 years, 5 months ago by
Forcetalks.
-
This discussion was modified 10 years, 6 months ago by
Log In to reply.
Popular Salesforce Blogs
Why Choose a Data Analytics Course in Bangalore at AchieversIT
Introduction In today’s data-driven world, organizations rely heavily on data analytics to make informed business decisions, improve performance, and gain a competitive edge. As a…
Salesforce for Manufacturing to Optimize Productivity
The manufacturing sector has witnessed a complete, factory-wide digital makeover. The industries have leveraged technologies like artificial intelligence (AI), robotics, and blockchain. Salesforce for manufacturing…
Salesforce for Agent Productivity: Boosting Sales in the Insurance Sector
The insurance sector is rapidly evolving due to changes in customer expectations and substantial technological advancements. Insurance agents have to face pressure to deliver faster,…
Popular Salesforce Videos
Apex Design Patterns : The Singleton Pattern in Salesforce || #Salesforce #DesignPatterns
The Singleton Pattern One Private variable of the class itself will hold the instance of the complete class so that we can access all the…
Salesforce Sales Cloud Implementation
There are many things to take into consideration when developing and deploying a Salesforce Sales Cloud implementation that will take your business to the next…
The Only Salesforce Developer Video Tutorial Course You Will Ever Need!
A Salesforce developer is a programmer who builds Salesforce applications across various PaaS (Platform as a Service) platforms. A Salesforce developer has an understanding of…