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

Default Value is replaced by prefix #694

Open
chrisvidal opened this issue Jul 6, 2022 · 2 comments
Open

Default Value is replaced by prefix #694

chrisvidal opened this issue Jul 6, 2022 · 2 comments

Comments

@chrisvidal
Copy link

I am using only the options `{"prefix": "https://" } to force an URL to be filled in.
But if the input already has a value, then the value is deleted by the prefix.
How to keep to the default value?

@n0xx
Copy link

n0xx commented Jan 18, 2024

Same issue, if value of input is set for +48 123 456 789 cleave strips it to +48+48123456

@YvesAmmann
Copy link

YvesAmmann commented Jul 17, 2024

My workaround: I set the default value after initialising the cleave component with Vanilla JS.

var config_key = document.getElementById('config_key');
var config_key_value = config_key.value;
var cleave_config_key = new Cleave('#config_key', {
	prefix: 'XXX-'
});
if (config_key_value) {
	config_key.value = config_key_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

3 participants