You could use `$.each` and add `return results.length <= limit` at the end of the function since $.each will end if the callback function returns false.