-
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, 11 months ago by
Sourabh.
-
This discussion was modified 9 years, 10 months ago by
Forcetalks.
-
This discussion was modified 9 years, 11 months ago by
Log In to reply.
Popular Salesforce Blogs
Hire a Salesforce Sales Cloud Developer for Growth
In today's fast-moving business environment, companies need a robust solution to manage sales teams, customer relationships, and revenue pipelines. That’s why many are turning to…
Salesforce Projects: Let's Spot the Trouble Before It Starts!
Imagine building a house. You wouldn't just start hammering without a plan, right? You'd check the soil, consider weather, and make sure you have the…
Popular Salesforce Videos
How Leadership Skills Helps to Shape Your Career? | Salesforce Learning
Leadership is an important skill to have because a good leader is able to bring out the best abilities in his/her team members and motivate…
Build Smarter Apps with Einstein Object Detection
Einstein Object Detection allows you to easily integrate advanced computer vision technology into your Salesforce workflows and external applications. Join us and learn how to…
Explain Standard Business Features of Salesforce?
Standard business features of Salesforce are Contact Management, Opportunity Management, Lead Management, Quote Management, Sales Management and Sales Forecasting. Watch the video to learn all…