been doing some research, but haven't found a solution for me. Basically, I have a small admin section that requires number inputs for calculations. ONLY numbers. BUT, the user can sometimes COPY AND PASTE including a $ or % character.
Now, I have found this: input field, only numbers jquery/js
$("input[type=text]").keypress(function (e){
var charCode = (e.which) ? e.which : e.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
});
which works perfectly during TYPING, however, if the user copies and pastes "$1230", it keeps the $ in there. I would like it to auto-strip it....
SO, basically, I am thinking instead of "return false", I need some sort of "replace"? Would that be the best way to go?