jquery Each loop,

Source: Internet
Author: User

jquery Each loop, to achieve the function of break and continue:
Break ----with return false;

Continue--with return ture;

each () function is essentially a tool-class function provided by all frameworks, through which you can iterate over the property values of an object, an array, and handle it. Both jquery and jquery objects implement this method, and for jquery objects, simply delegate each method: The jquery object is passed as the first parameter to jquery's each method. In other words, The each method provided by jquery is a method call to each of the child elements in the object provided by the parameter one. The each method provided by the JQuery object is invoked on a child element within jquery.

$.each (array, [callback]) traversal, very commonvararr = ['JavaScript','PHP','Java','C + +','C #','Perl','vb','HTML','CSS','objective-c'];$.each (arr, function (key, Val) {//Firebug ConsoleConsole.log ('index in arr:'+ key +", corresponding value:"+val); //if you want to exit the loop//return false;});

jquery Each loop,

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.