problems with jQuery-Mask-Plugin

0

I'm using jQuery-Mask-Plugin to create masks in the value fields, I liked it because it's very simple.

The problem is when I try to add a negative value it does not accept the -. But I did the internet and found a way to accept it. The problem is that it is not formatting the field correctly.

I'll put the code in JSFIDDLE because I could not make it work here.

JSFIDDLE

As you can see, the formatting must be equal to

If someone can help me, I'm very grateful.

I thought about changing something on the project, but I do not know what to do. Follow the link for the project code.

link

    
asked by anonymous 26.02.2016 / 20:01

1 answer

3

I recommend using the plugin jQuery maskMoney , this plugin will allow you to do exactly what you want in a simple and equivalent way.

Here's an example:

$(function() {

  $("input").maskMoney({
    allowNegative: true,
    thousands: '.',
    decimal: ',',
    affixesStay: false
  });

});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><scriptsrc="http://plentz.github.io/jquery-maskmoney/javascripts/jquery.maskMoney.min.js"></script>
<input type="text" />
    
26.02.2016 / 20:12