Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem entering decimal numbers < 1 #126

Open
RichardDavies opened this issue Feb 1, 2017 · 4 comments
Open

Problem entering decimal numbers < 1 #126

RichardDavies opened this issue Feb 1, 2017 · 4 comments

Comments

@RichardDavies
Copy link
Contributor

With the as-you-type formatting on an input that allows decimal numbers such as $('#price').number( true, 2 ); it behaves very oddly when entering numbers less than 1 such as 0.50, 0.25, or 0.01 etc.

This weird behavior is easily reproduced using your as-you-type demo with Chrome, Firefox, or IE.

@AnggonoHanggi
Copy link

AnggonoHanggi commented Feb 8, 2017

i also got strange behaviour when i want to show data with decimal number for example 100000000.0000
then i do $('.number').number(true, 4, ' , ', ' ');

it becomes 1 000 000 000 000,0000

@FrenchMajesty
Copy link

Dealing with the same problem. Has anyone found a solution to this?

@timothyfarmer
Copy link

I'm having these same issues and its causing me some grief. I'm guessing I just need to dive deep into this plugin and try to fix it.

@josexp3
Copy link

josexp3 commented Jul 6, 2018

You need to change the condition after this line:
// The whole lot has been selected, or if the field is empty, and the character
Instead of this
if (start == 0 && end == this.value.length || $this.val() == 0) use this one
if (start == 0 && end == this.value.length)

The or condition seems to be the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants