js event onchage, onkeydown, onkeyup, onkeypress. Real-time super search query, the query triggering event

onchange:

Mouse focus from the acquisition to begin storing the initial value, the mouse loses focus or the Enter key trigger to determine whether to change the values ​​changed on the trigger

onkeydown:

Key events, there worth considering is to get the value of Chinese input method is 229. The original is because in the Chinese input method, use keydown event, most of the keyboard ASCII value is 229, the input method automatically adds a value

onkeypress:

Chinese input method can not obtain, the English can get

onkeyup:

Comparing the input method can not only get to 229, but also to get the value of the key, to get both values, triggering two events.

 

 

html Add an event

js code reloadData method reloading data

Such input can be achieved soon match the query, do not point the button and hope for everyone
 

Published 17 original articles · won praise 0 · Views 224

Guess you like

Origin blog.csdn.net/lihailin8/article/details/103084940
Recommended