title: How to validate a currency input
body: <p>I am creating a form, and that includes salary, I need to check if the input value for salary is a valid currency and has two decimal places because that is what the database accepts. If the input for salary has alphabets (a-z) or symbols (!@#%^&amp;*() except for the $ or other currency sign) it should change the border color.</p>
  
  <p>example:</p>
  
  <pre><code>  10000.00
    25846.00
    213464.12
  </code></pre>
  
  <p>code:</p>
  
  <pre><code>function isNumeric(){
     var numeric = document.getElementById("txtSalary").value;
     var regex  = /^\d+(?:\.\d{0,2})$/;
     if (regex.test(numeric)){
       $("#txtSalary").css("border-color","#FFFFFF");
     }else{
        $("#txtSalary").css("border-color","#FF0000");
     }
   }  
  </code></pre>
  
  <p>This is already working as I wanted too, but the problem is I got 6 more input boxes that needs this kind of validation. How can I make that function, when called change the border-color of the specific selector and will return false is the value is not numeric something like:</p>
  
  <pre><code>isNumeric(selector);
  
  function isNumeric(selector){
      var regex  = /^\d+(?:\.\d{0,2})$/;
       $(selector).filter(function() {
          return (regex.test(this.value));
       }).css("border-color","#FF0000");
      }
  </code></pre>
  
  <p>Thanks!</p>