jQuery inputmask allowing placeholder text to remain

后端 未结 1 1945
清歌不尽
清歌不尽 2021-01-13 02:52

I am using the inputmask from https://github.com/RobinHerbots/jquery.inputmask and applying the mask to all textboxes with class \"date\". The problem I am having is that i

相关标签:
1条回答
  • 2021-01-13 03:08

    you could use the onincomplete event to clear the input when ever is not complete

    $('.date').inputmask("mm/dd/yyyy", {
      "placeholder": "mm/dd/yyyy",
      onincomplete: function() {
        $(this).val('');
      }
    });
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://rawgithub.com/RobinHerbots/jquery.inputmask/2.x/dist/jquery.inputmask.bundle.js"></script>
    
    <input type="text" class="date" />

    0 讨论(0)
提交回复
热议问题