這個jquery函數對於我來說非常適合作爲選擇時填充輸入框的下拉列表。如何在asp.net textbox中使用jquery函數
我的問題是我想使用一個ASP.net文本框而不是輸入框(主要是當我點擊「提交」按鈕時引用它)當我交換兩個我的下拉功能不再起作用。
感謝您的幫助
<html>
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Scrollable results</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<style>
.ui-autocomplete {
max-height: 400px;
overflow-y: auto;
/* prevent horizontal scrollbar */
overflow-x: hidden;
}
/* IE 6 doesn't support max-height
* we use height instead, but this forces the menu to always be this tall
*/
* html .ui-autocomplete {
height: 400px;
}
</style>
<script>
$(function() {
var availableTags = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
];
$("#tags").autocomplete({
source: availableTags
});
});
</script>
</head>
<body>
<div class="ui-widget">
<label for="tags">Select a procedure: </label>
<input id="tags" type="text" />
<asp:Button ID="Button1" runat="server" Text="Submit" />
</div>
</body>
</html>
你是如何設定ASP的ID:文本框?您需要使用ClientID,而不是ID。 – Crowcoder 2014-09-25 22:34:04