r/webdev • u/setmask • Jul 13 '16
Cleave.js - JavaScript library for Formatting input text content automatically
https://nosir.github.io/cleave.js/2
u/LynusBorg Jul 13 '16
This looks great. I think one thing that's missing is a .destroy() method to clean up event listeners etc. would be handy when used in an SPA.
1
u/setmask Jul 14 '16
hey, not sure if this is what you meant. https://github.com/nosir/cleave.js/blob/master/doc/public-methods.md#destroy
1
u/LynusBorg Jul 14 '16
...oh, Now I feel stupid. Could have sworn that was not there 2 days ago.
Maybe I confused yours with another library, was testing a couple that day.
Sorry!
1
3
u/canadianpersonas Jul 13 '16
prefer this one https://github.com/RobinHerbots/jquery.inputmask
2
u/setmask Jul 13 '16
That is nice, thanks for recommending~
2
u/canadianpersonas Jul 13 '16
BTW, I do like what I'm seeing from cleave.js. Will most def give it a try sometime. Thanks for sharing.
1
0
Jul 13 '16
[deleted]
1
u/setmask Jul 14 '16
Hey Eiskis, thanks for pointing this out. We will change the doc ASAP.
The decimal mark can be customised to "," by https://github.com/nosir/cleave.js/blob/master/doc/options.md#numeraldecimalmark
Also the thousand separator can be customised by
delimiter1
u/binwiederhier Jul 13 '16
Yup. The date time formatting thing and the thousand separator are American only.
4
u/Grimdotdotdot Jul 13 '16
64,100,000 people in the UK disagree that only America uses a comma ;-)
(As do 67,010,000 people in Thailand)
1
u/binwiederhier Jul 13 '16
True that. I should've know, hehe, in lived in the UK for over a year. ;-)
0
Jul 13 '16
[deleted]
2
u/setmask Jul 13 '16
Lol, well, I admit it's not very OO designed.
Please refer to the instance methods here: https://github.com/nosir/cleave.js/blob/master/doc/public-methods.md
3
u/[deleted] Jul 13 '16
Looks really nice. Good thing to have React support out of the box!