Project Summary of ios phone input text box, paste the code keyup event is invalid

Encountered such a problem in the project, and paste text button at the bottom of the code does not shine on ios phone and looked at the code, I use the event to listen keyup event, listens when user input. But do not come directly pasted into effect, and really quite unfriendly. Then how to solve this problem? So I checked online, he had this to say -keyup in ios phone native input method is not supported, but in the end ios third-party input method Sogou input method is supported for compatibility, you can not use keyup event . then what should we do? There are two solutions: using the input box input events and change events of these two methods can be overheard. Specific analysis and differences between the two methods is as follows:

1.change event
input input box onchange event will be fired when the input is losing focus;
not trigger a change in the input box when changing content, it will trigger when the mouse elsewhere points;
onchange event can also be used events after the radio buttons and check boxes to change the trigger.
onchange event in all major browsers support;
onChange attribute can be used to: <input>, <select> , and <textarea>.

2.input event
oninput event triggered when a user input, which is triggered immediately when the element value is changed;
the event is triggered when the value <input> or <textarea> element is changed.
Defects: the modified value will not trigger an event from the script. When prompted not trigger drop-down box to select a value from the browser. IE9 does not support the following, so IE9 available onpropertychange the following events instead.

发布了130 篇原创文章 · 获赞 103 · 访问量 26万+

Guess you like

Origin blog.csdn.net/xiaolinlife/article/details/90477430