title: Check input fields for numbers and hyphen
body: <p>I just want to check if a input-value is numeric and/or has a hyphen between two numbers. Comma should be replaced by point (1,23 -> 1.23) and spaces should be deleted.</p>
  
  <p>Allowed values are i.e.:</p>
  
  <pre><code>1
  2
  1-2
  34-45
  </code></pre>
  
  <p>Not allowed:</p>
  
  <pre><code>-2
  1-
  -
  any letters
  </code></pre>
  
  <p>My attempt:</p>
  
  <pre><code>$('form').submit(function( event ) {
      $('input').each(function(index, element) {
      $(element).val($(element).val().replace(",", ".").replace(" ", "")); // replace comma, delete spaces
      if (!$.isNumeric($(element).val())) {
          alert("error");
          event.preventDefault();
      }
      // else submit
  });
  </code></pre>
  
  <p>I think <code>isNumeric</code> is the wrong way, as '12-5' should be a valid value...</p>