-
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, 9 months ago by
Sourabh.
-
This discussion was modified 9 years, 8 months ago by
Forcetalks.
-
This discussion was modified 9 years, 9 months ago by
Log In to reply.
Popular Salesforce Blogs
How to Clone a Record In Apex?
What is Clone Record in Apex? The clone() method in Salesforce Apex makes a duplicate of the sObject record. There are four Boolean-type optional parameters…
Salesforce Marketing Cloud Datorama: Bring Your Data into Play
Datorama solves marketing data challenges, being one of the features of Salesforce Marketing Cloud. Looking for an in-depth overview of Salesforce Marketing Cloud and its…
Popular Salesforce Videos
Dean ERP : Salesforce ERP for Manufacturing and Distribution
Discover how Dean ERP, powered by Salesforce, is transforming the manufacturing and distribution industry with advanced ERP solutions. From real-time inventory management to seamless order…
Accelerate Revenue by Simplifying Partner Data Exchange
Adeptia Webinar :: Self-service approach to set up secured B2B data exchanges. Allowing IT to focus on governance for ensuring compliance, security, and control.Reducing IT…
Why To Sell Your SAAS Application On Salesforce AppExchange ?
From unparalleled market reach to seamless integration and trusted security, explore the benefits that await SAAS entrepreneurs on Salesforce AppExchange. Watch our latest webinar to…