-
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, 5 months ago by
Sourabh.
-
This discussion was modified 10 years, 4 months ago by
Forcetalks.
-
This discussion was modified 10 years, 5 months ago by
Log In to reply.
Popular Salesforce Blogs
Salesforce Data Integrity & How to Maintain it?
This blog on Salesforce data integrity features a brief intro to the contacts and accounts information inside the Salesforce and how do you establish a…
How to Upload and Show Images in Lightning Aura Component | Salesforce Developer Guide
In order to upload an image, you have two ways either use a standard file:upload or create a custom image file upload. Using the standard…
A complete list of Salesforce Events & Conferences for fall/winter 2018 – Part 2
What are industry’s Top Salesforce conferences and events heading to North America in the upcoming months? Let’s cut to the chase – here’s a list…
Popular Salesforce Videos
How Cyntexa Helped Diet Meal And Food Ordering Service Providers Offer Their Users The Ability To Order Online | Salesforce Commerce Cloud
It is important to keep your business at the top with the latest technical advancements. Presenting you a case study showcasing how Cyntexa Helped Diet…
What is Salesforce CPQ?
Unlock the power of Salesforce CPQ with our latest webinar. Whether you're a sales professional, business owner, or Salesforce enthusiast, this video breaks down the…
Build a Discount Calculator | Trailhead - Autolaunched Flow Salesforce Example
In this video, I'm creating a Discount Calculator with the help of Salesforce Flow to Automate Your Business Processes with Lightning Flow. So it's a…