I already am doing a replace for the commas in an textbox. How would I replace if there is an "$" and a comma also in the same line?
function doValidate()
{
var valid = true;
document.likeItemSearchForm.sup.value = document.likeItemSearchForm.sup.value.replace(/\,/g,'');
return valid;
}
Do you want to replace commas and dollar signs? Here's how:
"$foo, bar.".replace(/\$|,/g, "")
The regexp matches dollar signs or commas. The g
flag tells it to match the entire string instead of stopping after the first match.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With