I am trying to make a jQuery autocomplete inputbox, so that people can see suggestions that are pre-set. Not that hard actually, but somehow, I can't seem to solve a problem which won't show up the suggestions.
Here is a fiddle: http://jsfiddle.net/tbBy6/
And this is my HTML file:
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
$("input#search-textbox").autocomplete({
source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});
});
</script>
</head>
Textbox:
<body>
<input id="search-textbox" class="topic-picker ui-autocomplete-input" type="text" maxlength="100" name="q" accesskey="b" autocomplete="off" placeholder="enter text" role="textbox" aria-autocomplete="list" aria-haspopup="true">
Why can't I see a suggestion if I type "java" for example?
And my second question: How can I get data from the database to be fetched?
PS: I used the code from here: http://docs.jquery.com/UI/API/1.8/Autocomplete
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…