title: Remove all characters from string javascript
body: <pre><code>$('.hourfield').focusout(function() {
  
      var h;
      var m;
      var timeStr = "";
      var time = "";
      var newFormat = "";
  
      timeStr = $(this).val();
  
      //Here I would like to remove all characters which isn't numbers
      timeStr = timeStr.replace("/[^0-9\.]+/g","");
  
      if(timeStr &gt; 0) {
  
          h = timeStr.substr(0,2);
          m = timeStr.substr(2,2);
  
          newFormat = h+':'+m;
  
          //Add new values
          $(this).val(newFormat);
      }
  
  });
  </code></pre>
  
  <p><a href="https://dl.dropbox.com/u/20082618/kalendarium-2/index.html" rel="nofollow">URL to website</a></p>