HTML and CSS Reference
In-Depth Information
*/
_searchform.addEventListener('submit', function(e){
e.preventDefault();
// Clear the _searchTimeout timeout
clearTimeout(_searchTimeout);
var value = _searchfield.value;
if(value.length > 0){
_self.search(value);
}
});
...
}
Finally, you will need to bind an event to the actual input field. This will take the
value from the field, clear the searchtimeout (if it is set), check to see whether
the length of the string for the value is greater than zero, and then set a timeout
to perform a search.
var app = app || {};
app.controller = app.controller || {};
app.controller.movies = function(){
...
_searchfield.addEventListener('input', function(){
/**
* This is the value of the input field
*/
var value = this.value;
/**
* This will clear the search timeout
*/
clearTimeout(_searchTimeout);
/**
* You don't want to run search straight after every
* key press. This will set a timeout of 1 second
* (1000 ms) before the search function is called.
*/
 
Search WWH ::




Custom Search