Monitoring for a period of time did not input can be used for simple input complete
The last implementation of a simulated input completion is to send the request to the background to obtain data and display to the foreground of the problem, where the core criterion is the definition of input completion.
Namely: User how to calculate input completes.
I use the standard is that when a text box, inside the contents of 1 seconds unchanged, it means that the user has no input within 1 seconds, indicating that the user has entered the completion, and then wait to return data. So how does jquery realize that there's no input in 1 seconds?
Principle
It's just such a thin piece of code. The principle can be summarized as follows:
Each time the user presses the keyboard, the current period is recorded, and then the time is determined in 1 seconds.
Lasttime because it is a global variable, so when the user in the input, lasttime is always changing, so a second later with Lasttime-e.timestamp, only the last pressed E.timestamp that time will be 0.