title: credit card validation using jquery
body: <p>The code is not validating the values correctly, when i put in a simple digit it is already triggering the code.</p>
  
  <pre><code>$(".validate-card-num").live('keypress', function() {
      var ccNum = $(this).val();
      //var visa = /^4[0-9]{12}([0-9]{3})?$/;
      //var master = /^5[1-5]([0-9]{14})$/;
  
      if(ccNum.test(/^4[0-9]{12}([0-9]{3})?$/)){
          $("#img-visa").css("opacity","1");
          $("#img-master").css("opacity","0.3");
      }else if(ccNum.test(/^5[1-5]([0-9]{14})$/)){
          $("#img-master").css("opacity","1");
          $("#img-visa").css("opacity","0.3");
      }else
          $("#img-master, #img-visa").css("opacity","0.3")
  
  }); 
  </code></pre>
  
  <p>for example i put in "5" the value triggers the regex but when i put in another value it disables the regex all together.</p>