Listen to delete input value

One of the most recommended ways to listen for a change in an input text field is to bind this field to an event with a key. This works in most cases. But there are times when this does not work. In Firefox, for example, there is an option when the text is already selected to delete it using the context menu. And it does not work. However, I did not find any events that are being fired for this text field. Any suggestions on how I can respond to this (in pure Javascript or jQuery)?

+3
source share
2 answers

Watch the event oninput, and I will write about it here .

oninputIt works for all forms of text input - including cutting, pasting, undoing, repeating, clearing, dragging, and spelling correction. This is an HTML 5 event that is not supported in Internet Explorer 8 and below (but it is in the latest preview of IE 9). However, Internet Explorer supports its own event on all DOM objects onpropertychange. This is triggered whenever the value of an input element changes.

I didn’t notice that you checked - since you did it, it's probably worth mentioning that I wrote a plug-in for implementing cross-browser events oninput. You can find it here .

+8
source

- focus blur. . , ( ).

-, / . - blur/focus .

- , autosuggest/complete, , , .

0

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


All Articles