-
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
Salesforce Customization vs Configuration: What's the Difference?
Introduction: A Salesforce Development Company particularly deals with providing solutions to businesses with the help of Salesforce CRM. Before moving to the main point of…
Deleting Apex Classes / Apex Triggers From Production Using Workbench | Salesforce Tutorial
This is a rare scenario that we might face when not using any IDE or Source Control as part of the Salesforce Development. In order…
Popular Salesforce Videos
Overview of Salesforce Development Course | Learn Salesforce Development From Scratch
In this video, Shrey has given a detailed overview of the Salesforce Development Course. You will learn the following topics from this course: Salesforce Development…
How To Create Permission Set Group | Salesforce Development Tutorial
How to create permission set groups. This video will cover the following points - 1. Introduction Get a brief introduction about Permission Set Groups. 2.…
Rollup Trigger via Salesforce Record Triggered Flow - Trigger without code
Hello Folks, I created a Rollup trigger via Salesforce Record Triggered Flow (without code cool isn't). I use Record trigger Flow for that scenario. There…