Problem
You need to iterate or loop over each element in an array or attribute of an object.
Solution
Discussion
In this recipe, we iterate over both an array and an object using $.each(), which provides an elegant interface to the common task of iteration. The first argument to the$.each() method is the array or object to iterate over, with the second argument being the callback method that is executed for each element. (Note that this is slightly different from the jQuery collection method $('div').each(), whose first argument is the call back function.)
When the callback function defined by the developer is executed, the this variable is set to the value of the element currently being iterated. Thus, the previous recipe could be re written as follows:
|
|
J Query Related Interview Questions |
|
---|---|
HTML 4 Interview Questions | HTML Interview Questions |
HTML 5 Interview Questions | Zend Interview Questions |
PHP and Jquery Interview Questions | HTML+Javascript Interview Questions |
J Query Interview Questions | Javascript Objects Interview Questions |
Javascript Advanced Interview Questions | CodeIgniter Interview Questions |
JqueryUI Interview Questions | Dynamic HTML Interview Questions |
XQuery Interview Questions | jQuery Mobile Interview Questions |
JSON (JavaScript Object Notation) Interview Questions | Advanced jQuery Interview Questions |
J Query Related Practice Tests |
|
---|---|
HTML 4 Practice Tests | HTML Practice Tests |
HTML 5 Practice Tests | Zend Practice Tests |
PHP and Jquery Practice Tests | J Query Practice Tests |
CodeIgniter Practice Tests | Dynamic HTML Practice Tests |
JSON (JavaScript Object Notation) Practice Tests | Advanced jQuery Practice Tests |
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.