Is onpropertychange the equivalent of oninput?

Is it reasonable to associate an event handler with an element on both input and changechange events for targeted support for IE8 and other browsers?

$('.element').on('input propertychange', function(){...}); 

Or are there any pitfalls for this?

Edit

Is there a jQuery plugin that I can use to support the old version of IE?

+4
source share
1 answer

This is not quite the same. It will fire when there are JavaScript changes, not just user changes.

This means that the main error is that you can have infinite recursion if the provided handler does a JavaScript change for the same input or if there is some kind of circular reference where inputA changes inputB , which changes inputA .

I actually worked on this earlier today, hoping to find slight differences in the event object, which would allow me to distinguish between changes happening to the user and JavaScript changes, but I could not find them.

Edit

See this blog post for a possible jQuery plugin.

+2
source

Source: https://habr.com/ru/post/1484310/


All Articles