-
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, 10 months ago by
Sourabh.
-
This discussion was modified 9 years, 9 months ago by
Forcetalks.
-
This discussion was modified 9 years, 10 months ago by
Log In to reply.
Popular Salesforce Blogs
Azhar Iqubal: The Visionary Entrepreneur Behind Inshorts and Public
In the world of digital innovation, few names stand out as brightly as Azhar Iqubal. Known for co-founding two groundbreaking platforms, Inshorts and Public, Azhar…
3 Ways Salesforce Data Cloud is Transforming Healthcare
Healthcare is a constantly shifting industry and data can aid in making informed decisions that improve patient care. Despite this, the vast amounts of data…
Different Clouds in Salesforce and Potential Future
Salesforce offers a range of cloud-based software solutions that are designed to help businesses of all sizes manage their customer relationships, sales and marketing efforts,…
Popular Salesforce Videos
Salesforce Lightning User Tips and Tricks Spring 2023
SalesPath Corporation has created a video explaining tips and tricks that every Salesforce user will find helpful in order to increase productivity. This video also…
TOP 20 Salesforce Integration Interview Questions and Answers 2019 | Salesforce Integration
In this video, Wisdom Jobs and Tutorials explains the 20 most popular questions asked during Salesforce Integration interviews. These questions cover topics like what web…