question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mask Money not masking when input value is set programatically.

See original GitHub issue

Here is a simple JS fiddle to demonstrate:

http://jsfiddle.net/us6589rk/3/

Notice that the input lists as 5. But if you gain focus, then blur, it fixes it.

This might be related to issue #122

I will take some time tonight to see if I can fix for you.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

19reactions
p0vidl0commented, Jan 8, 2016

Its work fine in my code:

var newValue = 123;
$('input#apartment-pricetotal').val(newValue );
$('input#apartment-pricetotal-disp').val(newValue ).trigger('mask.maskMoney');

is any other more beautiful methods?

12reactions
viewbrasilcommented, Mar 5, 2017

Best Solution:

$('.maskMoney').maskMoney({allowNegative: false, thousands:'.', decimal:','});

$('.maskMoney').each(function(){ // function to apply mask on load!
    $(this).maskMoney('mask', $(this).val());
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

mask money not working on dynamically added inputs
i'm using jquery.maskMoney.js to add mask to the input it works for the normal input.
Read more >
A jQuery Plugin to make masks on form fields and html ...
To get your mask applied with the data-mask attribute just use it as the same way you use with the $.mask function. <input...
Read more >
How to transform input values using v-mask when building ...
In this article, we are going to be looking at input masking. You will learn how to quickly and easily apply masks to...
Read more >
Input Mask Guide | imaskjs
vanilla javascript input mask. ... Get/set value and unmasked value: mask.value ... var masked = mask.masked; masked.reset(); // UI will NOT be updated....
Read more >
Dynamic data masking - Azure SQL Database | Microsoft Learn
Users with administrator privileges are always excluded from masking, and see the original data without any mask. Masking rules - A set of ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found