title: Price field validation using javascript either jquery?
body: <p>I have a price field in my form i should allow decimal or floating point numbers only , not characters and any other special and white spaces in my price field. </p>
  
  <p>How could i get that?</p>
  
  <p>This is my code :</p>
  
  <pre><code>    $("#foo").blur(function() {
      var price = $("#foo").value;
      var validatePrice = function(price) {
     return /^(\d*([.,](?=\d{3}))?\d+)+((?!\2)[.,]\d\d)?$/.test(price);
  }
      alert(validatePrice(price)); // False
  });
  </code></pre>
  
  <p><a href="http://jsfiddle.net/T32KD/" rel="nofollow">Fiddle</a></p>