I've been trying to validate a quantity field by using regex to determine on keyup whether or not the value contains any non-numeric characters, yet for some reason (even though i've copied straight up someone elses to test) it does not work. Here is my code.
<input type="text" id="quanText" maxlength="2" value="0"></input>
var value= $(this).val().replace(/[^\d\.]/g, ''); $(this).val(value);
the replace() function is going to return you the replaced string which you then have to set back on 'this'