js中常用each来遍历dom元素,但是each总没有break,需要使用return false来跳出循环,其他return 0,return true,return 1都相当于continue,是结束当前循环。如下:
$('#freight option').each(function(){
console.log('info.freight'+info.freight);
if(info.freight==this.value){
console.log('info.freight=='+info.freight);
console.log($(this).is(':hidden'));
if($(this).is(':hidden')){
}else{
$('#freight_lock').prop('checked','checked');
$('#freight').val(info.freight);
}
return false;
}
});