jqueryjquery-inputmask

Can't add mask to input


I can't add mask to input. I use jquery plugin for it https://github.com/RobinHerbots/Inputmask. My code:

<input id="iii">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="jquery.inputmask.min.js"></script>
<script >
  $(document).ready(function () {
    $('#iii').inputmask({
      mask: 'dd.mm.yyyy',
      placeholder: 'dd.mm.yyyy'
    })
  })
</script>

Or https://jsfiddle.net/3179or5n/

Plugin is initialized and placeholder appears in input, no errors, but I can't enter data in this input. What am I doing wrong? Any ideas


Solution

  • Instead of mask you need to use these options:

    alias: 'datetime',
    inputFormat: 'dd.mm.yyyy',
    inputmode: 'numeric'
    

    For details see the doc

    $('#iii').inputmask({
        alias: 'datetime',
        inputFormat: 'dd.mm.yyyy',
        inputmode: 'numeric',
        placeholder: 'dd.mm.yyyy'
    })
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/RobinHerbots/Inputmask@5.x/dist/jquery.inputmask.js"></script>
    
    
    
    <input id="iii">