title: remove last invalid character, not first (javascript validation)
body: <p>I am trying to write a javascript validation method so that, if more than one capital letter is entered, it removes the other capital letters on the fly. However, it is removing the first capital letter, and I want it to remove the last one (which doesn't exist at <code>x=1</code>)</p>
  
  <p>This is my code...</p>
  
  <pre><code>for(var x = 1, j = value.length; x &lt; j; x++){
      if(value.charAt(x) != newValue.charAt(x)){
          valid = false;
          $("#text_10").attr({ 
              "value":$("#text_10").attr("value").replace(value.charAt(x), "")
           });
          finalVal = finalVal.replace(value.charAt(x), "");
      }
  }
  </code></pre>
  
  <p>Is there any way to identify that last typed letter, without reversing the string, so that I can remove the capital letter?</p>