jaridmargolin / formatter.js

Format html inputs to match a specified pattern
http://firstopinion.github.io/formatter.js
2.48k stars 235 forks source link

Browser Autofill not triggering re-format #95

Open jon-w1 opened 8 years ago

jon-w1 commented 8 years ago

When a user selects an option for a text input using Chrome (or another browser) autofill, the format functionality is not triggered.

-- Jonathan

Abdullahincep commented 7 years ago

if you are using blade template or twing template in laravel you need to do this

'pattern':'{{<?php echo e(999); ?>}}-{{<?php echo e(99); ?>}}-{{<?php echo e(9999); ?>}}',

iholler commented 7 years ago

Maybe I'm misunderstanding the situation here, but @Abdullahincep 's comment doesn't seem to match the question. Probably an fix someone has suggested before, but here's what worked for me in Chrome:

$('#input-element-id').on('input', function(){
  $(this).formatter().resetPattern();
});