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

Option to default value when value is empty #152

Open
LeonardoCamargo31 opened this issue Oct 26, 2021 · 0 comments
Open

Option to default value when value is empty #152

LeonardoCamargo31 opened this issue Oct 26, 2021 · 0 comments

Comments

@LeonardoCamargo31
Copy link

Does an option to pass a default value make sense when the input value is empty?

var output = opts.unit + signal + masked + opts.separator + cents;

Something like that:

var output = value !== "" ? opts.unit + signal + masked + opts.separator + cents : "";
return output.replace(clearSeparator, "") + opts.suffixUnit;

When using label inputs there is this problem:
Captura de tela de 2021-10-26 12-16-17

To fix this you need to use the dispatchEvent:

document.addEventListener('blur', (event) => {
      const bubbling = event.target.closest('.js-money')
      bubbling.dispatchEvent(new Event('input'))
})
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

1 participant