Cleave.js: Uppercase not working

Created on 7 Mar 2017  路  2Comments  路  Source: nosir/cleave.js

I am trying to get Cleave working to convert some fields to uppercase, but unfortunately I can not get it to work.

Please see one of the examples at https://jsfiddle.net/nosir/kbaxx64s/ . For instance, I have changed the last call to:

// custom
var cleaveCustom = new Cleave('.input-custom', {
    uppercase: true
});

I would expect that after running the fiddle, any values typed in the .input-custom element will be converted to uppercase. But, they are not. Am I doing something wrong or is this a bug?

Most helpful comment

I also expected uppercase to work with no blocks.

All 2 comments

Well, you will need to pass a mask block pattern as well, like [3, 3, ...] otherwise cleave.js would ignore it, that's where the lib's name comes from: cleave some stuff.

To make it work as you expected, you can pass [0, 9999] to it.

var cleaveCustom = new Cleave('.input-custom', {
    uppercase: true,
    blocks: [0, 9999]
});

Will close this for now.

I also expected uppercase to work with no blocks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ArtyomBist picture ArtyomBist  路  6Comments

wcedmisten picture wcedmisten  路  4Comments

ozkxr picture ozkxr  路  3Comments

d3bgger picture d3bgger  路  4Comments

Scit picture Scit  路  4Comments