title: jQuery Validate only decimal number
body: <p>Does anyone know how I can validate a price format like the following</p>
  
  <p>1.00  1200.00, but I also want to allow as 1 and 1200</p>
  
  <pre><code>$.validator.addMethod('decimal', function(value, element) {
          return this.optional(element) || /^[0-9]+\.\d{1,3}$/.test(value);
      }, "Please enter a correct number, format 0.00");
  
  jQuery.validator.setDefaults({
          debug: true,
          success: "valid"
      });
  
      $( "#myform" ).validate({
          rules: {
              field: {
                  required: true,
                  decimal: true
              }
          }
      });
  </code></pre>
  
  <p>^ I found this code, but it still allows commas.  Basically I am looking for something like is numeric without the comma.</p>
  
  <p>So basically only want to allow numbers and optional decimals. </p>
  
  <p>Any suggestion?</p>
  
  <p>Update:  So the above works, but its forcing the requirement of decimal. How to make that optional so I can do 1200  or 1200.00?  Or maybe there is a way to just convert 1200 to 1200.00 ? </p>