Firefox Javascript: Remove non-numeric characters from input of type "number" - FF issue
<p>the task looks simple. I have to remove non-numeric characters from an input field of type "number" on keyup in firefox.</p>

<p>The code:</p>

<pre><code>$("#field").on("keyup", function() {
 regex = /[\\D]+/;
 $(this).val( $(this).val().replace(regex, '') );
});
</code></pre>

<p>Unfortunately as soon as a non-numeric character enters the field, its whole content gets replaced by the empty string.</p>

<p>For example:</p>

<p>234d = emptied > should be 234</p>

<p>Solution (here because the question has been closed):</p>

<p>This example works. I found out that it has to do with the field type. If the input in the field of type "number" contains non numeric characters, firefox shows the input but doesn't store it in the input object. As soon as I use a text input everything works fine. Seems to be a Firefox issue.</p>

<p>I think this question is NOT duplicate because it seems to regard a Firefox issue with input fields of type "number".</p>