Currently using an AutoComplete instance to create a search feature
for an ecommerce site. The data source is a MySQL database containing
product names, descriptions, and URLs. So far so good. The data
source is returning the product name and URL, and the name gets
displayed in the AutoComplete text box. The name is linked to the URL
so that if you click the product name, you get taken to the product's
page on the site.
myAutoComp.formatResult = function(aResultItem, sQuery)
{
var myURL = aResultItem[1];
var myText = aResultItem[0];
if (myURL == "NOURL")
{
var sMarkup = myText;
}
else
{
var sMarkup = '<a href="' + myURL + '">' + myText
+ '</a>';
}
return (sMarkup);
}
The problem is that this works great for mouse clicks, but not for
anyone who uses the Enter key. Additionally only the product name is
actually a live link whereas it would be preferable for the whole
<li> element to be linked. Any clues on resolving these problems
please?
.