Reputation: 23
I am using maskMoney plugin here. I am trying to apply that mask to a div inner text, however i can't make it work.
var_value=$("#b_bouquet_originalvalue").text();
$("#b_bouquet_originalvalue").text($(this).maskMoney('mask',var_value));
console.log(var_value);
It does not work. any idea?
thanks for the support.
Upvotes: 1
Views: 3279
Reputation: 19288
maskMoney will only work on an <input>
element but it doesn't need to be visible.
You can use a hidden moneyMask <input>
as a formatter and copy its value to another element (eg div/span) of your choice.
$('#currency').maskMoney({prefix:'$'});//hidden by css directive
function set(val, $container) {
$('#currency').maskMoney('mask', val);
$container.text($('#currency').val());
}
Upvotes: 2
Reputation: 393
Try this :
$("#b_bouquet_originalvalue").maskMoney('mask',yourValue);
Upvotes: 0