I'm trying to find all letters and dashes and dollar signs and remove them from a text box.
function numbersOnly()
{
if ($('.sumit').val().indexOf([A-Za-z-$])) {
$('.sumit').val().replace([A-Za-z-$], "");
}
}
That's what I've got and I'm pretty sure it's wrong. I'm not too great with regular expressions, but I'm trying to learn them. Does anyone want to help me out and get me started with completing this function?
So.. You've got the inputs.
<div class="numInputRight"><input type="text" class="sumit" name="sumAmount1"></div>
<div class="numInputRight"><input type="text" class="sumit" name="sumAmount2"></div>
<div class="numInputRight"><input type="text" class="sumit" name="sumAmount3"></div>
Then you've got the function:
numbersOnly = function()
{
$('.sumit').val().replace(/[A-Za-z$-]/g, "");
alert($('.sumit').val());
return false;
}
I'm alerting to determine if the replace is working. It's not. The link to the page is
Appreciate every ones input on this!