$ ('. Container '). each (function (i) {
if ($ (this). attr (' name ') = = "Continue") {
return///implement Continue function
}else if ($ (this). attr (' name ') = = "Break") {
Return false;//implement Break function
}
})
Look at the jquery each function
When you want to use return true for this function in each, you simply let each continue and
There's no interruption to each, so the function can't return.
Each of the jquery works well, except for loops that use it instead of web effects
function MethodOne () {
....
$.each (Array,function () {
if (condition set) {
return true;
}
});
....
}
Break Continue instance
Continue:return true;
Break:return false;
Direct return will also jump out of jquery.
So, you can write the following code:
$ (' Li '). each (function (index) {
if (index==2) return true;
if (index==4) return false;
$ (this). CSS tutorial ("Border", "1px red Solid");
});