autocomplete
in Using jQuery UI
•
8 years ago
hey guys im trying to develop a autocomplete search input field but I want to add a search category inside the input field where they can select other search options to define their choice
search options I wish to put into the input field on the right
<ul id='search_options'>
<li class='title'><strong>Category Selection:</strong></li>
<li class='app'>All Categories</label></li>
<li class='app'>Electrical</label></li>
</ul>
autocomplete code
$(document).ready(function()
{
function search_autocomplete(selector, tags, default_value)
{
$('#' + selector).focus(function()
{
if($('#' + selector).val() == default_value)
{
$('#' + selector).val('');
}
});
$('#' + selector).blur(function()
{
if($('#' + selector).val() == '')
{
$('#' + selector).val(default_value);
}
});
$('#' + selector).autocomplete(
{
source: tags
});
}
var availableTags = [ "ActionScript",
"AppleScript",
"Asp"];
search_autocomplete('query', availableTags, 'Search...');
});
any help would be appreciated thank you
1