'Add class on input focus
Here my solution: Add class on input focus and remove if country change
el.addEventListener('countrychange', function() {
let $this = $(el);
$this.inputmask('remove');
$this.val('');
$this.removeClass('mask-added');
});
$(el).on('input', function() {
let $this = $(el),
placeholder = $this.attr('placeholder'),
mask = placeholder.replace(/[_]/g, '9');
if(!$this.is('.mask-added')) {
$this.val('');
$this.inputmask(mask);
$this.addClass('mask-added')
}
});
This works for me
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
