Home > Web Front-end > JS Tutorial > jQuery each terminates or skips example code_jquery

jQuery each terminates or skips example code_jquery

WBOY
Release: 2016-05-16 17:09:27
Original
1186 people have browsed it

When iteration is involved, abnormal termination or forced skipping is inevitable. In jQuery's each function, there is the following relationship:
continue :return true;
break :return false;
Direct return will also jump out of jQuery.

Set the drop-down list to select and terminate the iteration

Copy the code The code is as follows:

$("#area option").each(function(){
if($(this).text()==addrTmp[2]){
$(this).attr("selected ", "selected");//
return false;
}
});
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template