-
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
Top 5 Reasons To Hire a Salesforce Consultant Over an Internal Admin
Adopting Salesforce can be quite a challenging decision if marketers fail to understand the Salesforce platform and its capabilities. Many organizations want to get the…
Salesforce for the Freight and Logistics Industry
Contents 1 Introducing Salesforce for the Freight and Logistics Industry 2 Challenges in the Logistics Sector & How Salesforce CRM Helps 3 How is Salesforce CRM Beneficial for…
How a Dedicated Salesforce Lightning Developer Can Upgrade Your CRM
Welcome to the future of customer relationship management! In today's fast-paced digital world, staying ahead of the curve is not just a choice but a…
Popular Salesforce Videos
Salesforce & Google Analytics integration
Salesforce is one of the most popular CRMs available today. Many teams use Salesforce heavily for reporting and analysis. The ability to model the data…
Salesforce Workbench | Salesforce Tutorial Video
In this video, we show you how to use Salesforce Workbench to set a user password. This can be useful when you have a user…
Salesforce - Sage ERP Integration
Salesforce Integration with Sage ERP (SageX3 / Sage100 / Sage300) delivers seamless, real-time, bi-directional integration that plays a pivotal role in unlocking the potential of…