Check all values in an array are same
<p>I have a webpage that has a textbox.  </p>

<p>When the user enters information into it, it makes a AJAX call to see if the entry is valid, if not it disables a button.</p>

<p>They can also add up to 10 textboxes which is done via jQuery Templates. At the moment each textbox has a class of serial and when a serial textbox is blurred it does this check.  </p>

<p>If they enter a invalid serial it will disable the button but if they add a new textbox and that is valid the button is now enabled which is wrong as there is one still invalid.</p>

<p>The only way I can think to do this is to add a 1 or 0 to an array for each textbox and once all elements in the array are 1 then enable the button.  Is that a good approach, if not please explain a better one.  If it is a good approach how do I check all values in a javascript array are the same?</p>

<p>Thanks</p>
