return false: will stop the loop (just like using 'break' in a normal loop).
return true: Jump to the next loop (just like using 'continue' in a normal loop).
function test(){
var success = false ;
$(..).each(function () {
if (..) {
success = true;
return false;
}
});
return success ;
}
jquery is an object chain, so $(..).each() still returns a collection of objects. each(function(){}): It is a callback function. In the callback function, the result cannot be returned outside the callback function each.
Statement: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