jjzjj

hasThing

全部标签

Javascript 函数不会在返回时中断?

我知道您应该能够通过return来跳出each语句,这正是我想要做的,但我一定是做错了什么,它看起来太简单了,我找不到它。我有这样的代码functioncreate(){vartest=hasThing();if(test){$('#myForm').submit();}else{alert('yousuck!')}}functionhasThing(){$('.selects').each(function(){if(this.value!=""){returntrue;}});returnfalse;}我已经在“returntrue”上设置了断点;并点击它,但vartest始终为假