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
This worked for me:
$('.sumit').val().replace(/[^\d]/g, "");
I tried Mike's answer with the capital \D instead of negating a \d first which for some reason didn't remove parenthesis and other punctuation for me. Negating \d works perfect.
If you want to keep decimals, maybe put a dot and other symbols within the square brackets too.
PS The environment in which I tested was Titanium SDK.