jquery-inputevent icon indicating copy to clipboard operation
jquery-inputevent copied to clipboard

Seems to have problems when binding to the event further up the DOM

Open chrisnicola opened this issue 12 years ago • 1 comments

I have a page that loads form elements dynamically after load. In order to catch events fired by these elements I have attached to the event further up the DOM like this:

  $('body').on 'txtinput', '[data-toggle=clear]', (e) ->

However after the first text box I interact with none of the ones I interact with after that fire the event correctly.

I'm using the latest Chrome on OSX.

Tracing through it quickly the problem seems to be with how the event is bound if isSupported(elem) is false using the dlgtTo events. Anyways I'd try for a fix, but give that this library is attempting to be 100% cross-browser compatible I think it might be a bit hard.

Anyways an alternative fallback I've taken the approach of just polling any focused textboxes every 500ms or so. This approach could simply be "skipped" for browser that properly support the new "input" events. It isn't perfect, but it works for most scenarios.

chrisnicola avatar Aug 12 '12 19:08 chrisnicola

Here is a Gist of the plugin I've written to solve this for my scenario anyways https://gist.github.com/3191297

And a link to the blog post about it http://lucisferre.net/2012/07/27/jquery-plugin-for-really-tracking-text-input-changes/

Would love your feedback on the approach and if there are any pitfalls I'm not recognizing.

chrisnicola avatar Aug 12 '12 19:08 chrisnicola