Sk Asraf Sk Asraf - 6 months ago 28
jQuery Question

in google search box which event fire?

in google search box when we typing something , On that time some auto complete result coming after select any one it automatically fire no need to


focusout()



or


any
click()



how it create

Answer

There are basically three key related events keydown, keypress and keyup, it is using combination of these events... To make you understand more here is the detail

keydown is fired when the key is down (like in shortcuts; for example, in Ctrl+A, Ctrl is held 'down'.

keyup is fired when the key is released (including modifier/etc keys)

keypress is fired as a combination of keydown and keyup, or depending on keyboard repeat (when keyup isn't fired). (this repeat behaviour is something that I haven't tested. If you do test, add a comment!) If user keep key pressed, then this event is fired for every character added by the browser.

NOTE: Remember one thing, if you are fetching the value from the field never ignore the keyup event, because while getting text of the input you won't get the last type character from the textfield until keyup event is fired...

See this fiddle to get more idea about key events..