-
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 8 years, 1 month ago by Sourabh.
- This discussion was modified 8 years ago by Forcetalks.
Log In to reply.
Popular Salesforce Blogs
Top 150+ Salesforce Interview Questions
Top 150+ Salesforce interview questions and answers with detailed explanation Salesforce Interview Questions Part 1 1. What is Cloud Computing? Answer: Cloud computing is defined…
Salesforce Lightning Tutorials with Sample Code
Salesforce Lightning Framework is the Customer-focused UI designed to build powerful dynamic apps for mobile, web, and desktop devices. The task of a Salesforce developer…
Protect Your Salesforce Data : Salesforce Security
For admins and developers, picking informational collections to which every client or gathering of clients can see is one of the essential choices that influence…
Popular Salesforce Videos
Create Reports In Salesforce With Report Builder
Create reports in Salesforce with Report Builder. In this video, the following points will be covered - 1. Introduction Get a brief introduction about reports…
Getting to Know Einstein Analytics
Einstein Analytics is an app used to visualize the activity occurring in your Salesforce environment. Whether you use Salesforce for Sales, Marketing, or Service, this…
Salesforce Lightning | Campaigns
When your eComm specialist creates a campaign or report for a specific audience, you can view it in Salesforce. Check out this video to learn…