我在旧的自动完成 jquery 上工作,我找到了一些代码,它工作得很好,但我想添加一个新功能。选择一个选择之一时,应单击“提交”按钮。但我不擅长 JQuery。有人帮忙吗?
ASP 页面
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ASP AutoComplete</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.autocomplete.pack.js"></script>
<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />
<script type="text/javascript">
function test(){
alert("test);
}
//Script Features::: http://docs.jquery.com/Plugins/Autocomplete/autocomplete#url_or_dataoptions
$().ready(function() {
function formatItem(row) {
return row[0] + " (<strong>id: " + row[1] + "</strong>)";
}
function formatResult(row) {
return row[0].replace(/(<.+?>)/gi, '');
}
$("#input").autocomplete("sorgu.asp", {
width: 151,
selectFirst: false,
cacheLength : 0,
minChars: 2
//autoFill: true
});
$("#input").result(function(event, data, formatted) {
if (data)
$(this).parent().next().find("input").val(data[1]);
});
});
</script>
<style type="text/css">
body { font-family: Helvetica; font-size: 12px; color: #000; }
</style>
</head>
<body>
<div>
<form>
<div>
<div style=" font-size: 20px; color: #F00;">Write some Letter:<div/>
<p>
<label><b>Search:</b></label>
<input type="text" id="input" />
<button value="Submit" onClick="test()" id="bt1">Submit</button>
</p>
</div>
</form>
</div>
</body>
</html>