JQuery each function

Source: Internet
Author: User
Tags arrays continue return

Each function in jquery is handy, and the $.each () function encapsulates a very powerful traversal function that traverses one-dimensional arrays, multidimensional arrays, DOM, JSON, and so on.
$ (": Checkbox[name= ' sysmonitoroption '][checked=true]"). each (function () {
Sysmonitorlist.push ($ (this). Val ());
});
We can break the $.each () loop at a particular iteration by making the callback function to return FALSE. Returning Non-false is the same as a continue statement into a for loop; It'll skip immediately to the next iteration.
What if we want to continue or break the loop halfway?
In each of the jquery ()
return true equals continue;
return false equals break;

But if a JS function also needs to be in each of the condition is not appropriate when return false; The idea now is to set a variable to determine whether to return false after each end.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.