I have such code:
function allValid() { $('input').each(function(index) { if(something) { return false; } }); return true; }
which always returns true as return false; affects anonymous inner function. Is there an easy way to call outer function's return?
return false;
PS. I am not looking for a workaround, just want to know the answer to original question. If the answer is "not possible" it is fine.
Yeah, store it in a local variable.
function allValid() { var allGood = true; $('input').each(function (index) { if (something) { allGood = false; } }); return allGood; }
2.1m questions
2.1m answers
60 comments
57.0k users