title: How to validate a credit card number
body: <p>I just want to validate a credit card number in the JavaScript code. I have used a regular expression for digit numbers, but I don't know why it is not working!</p>
  
  <p>Here is my function as per below:</p>
  
  <pre><code>function validate_creditcardnumber()
  {
      var re16digit = /^\d{16}$/
      if (document.myform.CreditCardNumber.value.search(re16digit) == -1)
          alert("Please enter your 16 digit credit card numbers");
      return false;
  }
  </code></pre>