We've put frustrating hours into the attempt to get a remarkably simple script to work (and everyone else seems to be successful). Finally, we want to create an autosuggest textbox using JQuery that writes the value of a selected text into a hidden field, but this question isn't about that because even the first step fails (but working sample code regarding that is very welcome).
For some obscure reason, formatItem (and the other formatting functions) is not executed. What are we misunderstanding?
Any help is HIGHLY appreciated.
Here's the code (stripped of anything not needed for the example):
<html>
<head>
<title>Why o why?</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function() {
var s = ["a", "b", "ab"];
$("#txtSearch").autocomplete({
source: s,
formatItem: function(row, i, n) { return "whatever" },
minLength: 1
});
});
</script>
</head>
<body>
Search <input id="txtSearch" type="text" />
</body>
</html>
The autosuggest function as such is working in any browser, but no browser fires formatItem.