RobinHerbots / Inputmask

Input Mask plugin
https://robinherbots.github.io/Inputmask/
MIT License
6.36k stars 2.18k forks source link

Is there a way to hide placeholder hyphens and only show them when the characters are entered? #2802

Closed hexerus closed 4 days ago

hexerus commented 4 days ago

Using the placeholder option: <script> $('#phone').inputmask('999-99-9', {'placeholder': ''}); </script> has disabled the underscore placeholders, but not the dashes. Image 1 (field not in focus, correct): Screenshot 2024-07-04 115951 Image 2 (field in mouse focus, these are the dashes I want to hide): Screenshot 2024-07-04 120005 Image 3 (only show them when the characters are entered up to that point in green, not show the one in red): Screenshot 2024-07-04 120014

Techn1c4l commented 4 days ago

Use showMaskOnFocus, showMaskOnHover and jitMasking options like this:

$(function() {
  $('#myInput').inputmask('999-99-9',
  {
      placeholder: '',
      showMaskOnFocus: false,
      showMaskOnHover: false,
      jitMasking: true
  });
});
hexerus commented 4 days ago

jitMasking: true appears to works alone on itself, thanks.