D
D
danilr2019-11-08 20:25:04
Vue.js
danilr, 2019-11-08 20:25:04

How to use jquery input mask?

I installed the npm package https://github.com/igorescobar/jQuery-Mask-Plugin/...
And now I don't know how and where to use it.

mounted() {
  jQuery(function($){
      $(".input-phone").mask("+7(999) 999-99-99");
     });
}

I tried to call it in the mounted() of the Input component, but it gives the following error. Uncaught TypeError: $(...).mask is not a function
Tell me where and how to use this package?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2019-11-08
@zkelo

Vue and jQuery are different things. Vue has its own corresponding package - vue-inputmask

I
imp-1903, 2019-11-14
@imp-1903

As Alexander already said, Vue has its own solutions. I want to supplement his answer with another option that I personally like better - https://vuejs-tips.github.io/vue-the-mask/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question