JQuery's each terminates or skips the sample code
- 2020-03-30 00:53:15
- OfStack
When iteration is involved, it is inevitable that there will be abnormal terminations or forced skips. In jQuery's each function, the following relationships exist:
The continue: return true;
Break: return false.
Direct return also pops out of jQuery.
Set the drop-down list to select and terminate the iteration
The continue: return true;
Break: return false.
Direct return also pops out of jQuery.
Set the drop-down list to select and terminate the iteration
$("#area option").each(function(){
if($(this).text()==addrTmp[2]){
$(this).attr("selected", "selected");//
return false;
}
});