-
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, 8 months ago by
Sourabh.
-
This discussion was modified 9 years, 7 months ago by
Forcetalks.
-
This discussion was modified 9 years, 8 months ago by
Log In to reply.
Popular Salesforce Blogs
Understanding Custom Metadata Types In Salesforce
Understanding Custom Metadata Types in Salesforce Custom Metadata Types in Salesforce are a powerful tool for storing and retrieving small amounts of configuration data within…
Become A Salesforce Certified Professional & Enjoy The Competitive Advantage
The demand for Salesforce certified professionals have been increasing at a massive pace and this is making more and more professionals think about how to…
Salesforce Lightning Object Creator & Lightning Flow Builder: 2 Amazing Tools To Play With!
By making use of the brand new introduction of the low code tools, Salesforce is encouraging businesses to modernize their applications with simplicity. Salesforce has…
Popular Salesforce Videos
Salesforce - How to Create and Debug Process Builders
Check out this video on how to debug Process Builders. Once you really get into building processes in Salesforce in can be confusing as to…
Geocoding and Reverse Geocoding in Salesforce | Google Maps APIs
In this video, you will learn to use Geocoding and Reverse Geocoding service in your Salesforce Org. Geocoding is the process of taking input text,…
Heroku | Salesforce Development Course
Knowledge of Heroku is also required to crack the Salesforce PD 1 Certification Examination. Let’s understand what Heroku is and what are its uses, in…