jaridmargolin / formatter.js

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

jQuery input event suppressed #52

Closed popko closed 8 years ago

popko commented 10 years ago

Enabling formatter for example in an input element prevents to fire jQuery input event on that particular element. I consider this a bug.

joshminnie commented 10 years ago

+1

I'm experiencing the same thing.

jaridmargolin commented 10 years ago

I consider it a bug as well. I will investigate when time permits.

gmanley commented 10 years ago

I solved this by adding:


      if ('createEvent' in document) {
        var evt = document.createEvent('HTMLEvents');
        evt.initEvent('input', true, true);
        this.el.dispatchEvent(evt);
      } else {
        this.el.fireEvent('oninput');
      }

to line 694 of merged source or https://github.com/firstopinion/formatter.js/blob/master/src/formatter.js#L317. Definitely just a temporary fix. It will work in IE8+.

vialcollet commented 9 years ago

@gmanley Thanks. This is solving the issue on using formatter.js in AngularJS.

popko commented 8 years ago

Thanks @gmanley