Создать плагин jquery, который использует автозаполнение
Я пытаюсь создать плагин jquery для моего сайта, который использует автозаполнение для заполнения текстового поля. Я пытаюсь назвать это как:
$("#txtBox").suggest()
с моей страницы HTML. Это мои ссылки.
<!DOCTYPE html>
<html>
<head>
<title>Suggest</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script src="http://localhost:8080/Trial/test.js"></script>
<script type="text/javascript">
$(function () {
$("txtBox").suggest();
});
</script>
</head>
<body>
<p>Enter a Symbol:</p><br />
<input type = "text" id = "txtBox" />
</body>
</html>
Это мой плагин test.js:
(function ($) {
$.fn.suggest = function () {
//Autocomplete not found!
this.autocomplete ({
source: //Some source
},
minLength: 1
});
}(jQuery));
Он говорит, что автозаполнение не определено. Кто-нибудь может помочь?