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

Use a prefix containing the delimiter #692

Open
micarmst opened this issue Jun 21, 2022 · 1 comment
Open

Use a prefix containing the delimiter #692

micarmst opened this issue Jun 21, 2022 · 1 comment

Comments

@micarmst
Copy link

I'd like four blocks of three numbers separated by a hyphen. The first two blocks of numbers are fixed (see the prefix) and the user only provides the last two blocks of digits:

var cleave = new Cleave('.input-custom', {
    prefix: '785-223',
    blocks: [3, 3, 3, 3],
    delimiter: '-',
    numericOnly: true
});

https://jsfiddle.net/fjmh9Lwt/2/

However this does not display correctly and I'm also unable to type in to the textbox. I thought maybe the prefix cannot contain the delimiter so tried removing it and relying on the blocks to add it. Although this way displays correctly I still can't type in to it:

var cleave = new Cleave('.input-custom', {
    prefix: '785223',
    blocks: [3, 3, 3, 3],
    delimiter: '-',
    numericOnly: true
});

https://jsfiddle.net/fjmh9Lwt/3/

Any ideas on how I can achieve this?

@Helox
Copy link

Helox commented Nov 17, 2023

Same, using prefix like 'W' works but 'W-' does not, input blocks and typing does not change the value.

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

2 participants