-
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 7 years, 11 months ago by Sourabh.
- This discussion was modified 7 years, 10 months ago by Forcetalks.
Log In to reply.
Popular Salesforce Blogs
Data Quality Analysis Dashboard App in Salesforce
As you all know about the importance of Data Integration in Salesforce, we should understand that before Data integration, Data Quality analysis and management are…
How You Can Boost Online Grocery Sales? | Salesforce Help Guide
COVID-19 has accelerated the shift to eCommerce and it is more evident than in the grocery category. Online grocery buyers have increased nearly 30 percent…
Top 6 Benefits of Salesforce QuickBooks Integration
QuickBooks is an essential accounting application that many businesses trust today. It allows accounting professionals to record transactions with ease and accuracy. Whether you're billing…
Popular Salesforce Videos
DreamTX Welcome Day 3: Customer Success | Dreamforce 2020 | Salesforce
If you missed DreamTX DAY 2, then live this amazing experience here, we have covered it all for you. Digital transformation requires more than just…
Build a Simple Screen Flow with Salesforce Flow Builder
Did you know that you can build interactive custom components without any code? Flow Builder is a powerful tool for automation and for giving Admins…
Salesforce Careers - Why Consider A Career In Salesforce
This Salesforce Training Video will help you understand about Salesforce, Salesforce market situation, Salesforce job trends, Salesforce career options and how Salesforce is a safe…