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

Inputmask ignores changes to the placeholder when resetting it. #2817

Open
chriscpty opened this issue Aug 30, 2024 · 0 comments
Open

Inputmask ignores changes to the placeholder when resetting it. #2817

chriscpty opened this issue Aug 30, 2024 · 0 comments

Comments

@chriscpty
Copy link

chriscpty commented Aug 30, 2024

On the mouseout event, inputmask resets the input's placeholder to whatever placeholder it had when inputmask was first initialised.
If the placeholder on the input was changed afterwards, the new placeholder gets lost.

Minimum reproducible example:

<!DOCTYPE HTML>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="jquery.inputmask.js"></script>
</head>
<body>
<input type="text" id="inputmask_example" placeholder="old placeholder" />
<script>
$('#inputmask_example').inputmask("99-999999");
$('#inputmask_example').attr('placeholder', 'new placeholder');
</script>
</body>
</html>

When hovering and then leaving the text input, its placeholder is set back to "old placeholder".

Expected behaviour (IMO) would be that if the input's placeholder is changed by something other than inputmask, inputmask should remember that placeholder as the placeholder to reset to (from taking a short look at the code, i believe that'd be in the originalPlaceholder attribute of the inputmask object).

Alternatively, there should be an option to manually set the originalPlaceholder to avoid this issue.

Inputmask version: I could reproduce this on both 5.0.9 and 5.0.10-beta.8
OS: Windows 10
Browser: I could reproduce this on both Firefox and Chrome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants