Possible Duplicate:
Remove characters from a string
I have a variable p
which I would like to remove the $
from. This variable will be a number such as $10.56
. How can I do this? I thought it could be done using .replace('$','')
but i'm not quite sure how to implement this.
Here is my javascript code:
function myFunction() {
var p = parseFloat(document.getElementById('p_input').value);
var q = parseFloat(document.getElementById('q_input').value);
if (!q){
document.getElementById('t').value = '';
}
else {
var t = q * p;
document.getElementById('t_output').value = t;
}
}