Documentation

Plugins/Autocomplete/search

From jQuery JavaScript Library

Jump to: navigation, search

« Back to Plugins/Autocomplete

search( )

Trigger a search event.
See result(Function) for binding to that event.
A search event mimics the same behaviour as when the user selects a value from the list of autocomplete items. You can use it to execute any function (bound via result() method) that does something with the selected value, beyond simply putting the value into the input and submitting it. For example, it can be useful to verify whether the entered value is an existing option.


Examples:

Triggers a search event.

$('input#suggest').search();
		

Verifies if the entered value was an existing option after the element loses focus.

$('input#suggest').result(function(event, data, formatted) {
		    $('#result').html( !data ? "No match!" : "Selected: " + formatted);
		}).blur(function(){
		    $(this).search();
		});
		

function findValueCallback(event, data, formatted) {


}

NameType