jQuery - returning control during loop
<p>I am brand new to jQuery (and really javascript in general) and am trying to write a generic function that checks all text and select boxes on a page for input, returning 'true' if one or more boxes on the page contain at least one character and 'false' if not (the use is to disable a search button if there is no input).  I've written the following function:</p>

<pre><code>    function hasUserProvidedInput() {
        $('input[type="text"]').each(function() {

            if ($(this).val() != '') {
                alert("he has");
                return true;
            }
        });
        $('select').each(function() {
            if ($(this).val() != '') {
                return true;
            }


        });

      return false;  
   }
</code></pre>

<p>The intent is that it will iterate through all textboxes and select boxes on the page, and the second it hits one with input it will return control to the calling function with a value of 'true' (I call the function with keyup events attached to textboxes and select boxes on the page).  If it iterates through all these controls on the page and does not find one with input, it will return false.</p>

<p>I added the alert in for debugging purposes.  The alert works properly to indicate when a textbox contains input, however my function always returns with a value of 'false'.  Can anyone shed some light for me on why this is happening/how I can fix it?  Thanks.</p>
