i was looking around in the forum but i cant find anything like my case, sorry if duplicated.
i was found mask currency js but not work when im try to send the value into input text value.
the error is result from var masknumber can't fill in result money value. but when im try using document.write the result its work..
how im using masknumber value to form #resultsummoney ?
Here .JS
function format2(n, currency) {
return currency + " " + n.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1.");
}
var qty = document.frm_money.qty.value;
var money = document.frm_money.money.value;
var sum = eval(qty)*eval(money);
var masknumber = document.write(format2(sum, "$") + "<br />");
document.frm_money.resultsummoney.value=masknumber;
and Here is HTML form
<form name="frm_money">
<input type="text" name="qty" id="qty" value="10">
<input type="text" name="money" id="money" value="12000">
<input type="text" name="resultsummoney" id="resultsummoney" >
</form>