I am using devbridge jquery autocomplete plugin. I have combined two tables in databes with union and i have listed search results like this:
query: for sale
ADVERTS
For Sale Vauxhall 10,000 EUR ID 13245
For Sale Volkswagen 12,000 EUR ID 13246
For Sale House 199,000 EUR ID 13247
AD CATEGORIES
Cars For Sale (2 Cars in list)
House For Sale (1 House in list)
The thing is it’s ok when user clicks on “For Sale Vauxhall 10,000 EUR ID 13245” or “Cars For Sale (2 Cars in list)”
However when user clicks on “ADVERTS” or “AD CATEGORIES” input filled like this:
"<center><b>ADVERTS</b></center>"
And when user hovers mouse icon into the title info box appears with tags included.
Is there a way to prevent this ? I have tried that code but although it prevents submit the form it doesn’t prevents filling input :
onSelect:
function(value, data){
if(data!="title") {
$("input#data").val(data).show();
$("form#autocomplete").submit();
} else {
return false;
}
},
How to prevent something happen when user clicks on these titles ?
If you’re looking for an autocomplete plugin that supports categories, check out jQuery UI’s: http://jqueryui.com/demos/autocomplete/#categories .