jquery自动完成选择不起作用 [英] jquery autocomplete select not working
问题描述
我正在使用jquery-ui-19.2自动完成。我从数据库中获取数据并查看输入中的列表,但我无法选择项目。无论何时我尝试选择项目,项目列表都会消失。
< link rel =stylesheettype =text / csshref =../ static / css / jquery-ui-1.9.2.custom .css/>
< input type =textid =TextBox1/>
< script type =text / javascript>
I am using jquery-ui-19.2 Autocomplete .I am getting the data from database and tring to see the list in input , but i am not able to select the item .Whenever i try to select the item the item list disappears.
<link rel="stylesheet" type="text/css" href="../static/css/jquery-ui-1.9.2.custom.css" />
<input type="text" id="TextBox1" />
<script type="text/javascript">
<script src="../static/scripts/jquery-ui-1.9.2.custom.js" type="text/javascript"> </script>
<script src="../static/scripts/jquery-1.10.min.js" type="text/javascript"></script>
$( function()
{
var availableTags = [<%= SuggestionList%> ]。
$(#TextBox1)。自动完成(
{
来源:availableTags,
autofocus:true,
select:function(event,ui){
$(#TextBox1)。val(ui.item.value); < br $>
}
}) ;
});
$(function()
{
var availableTags = [ <%= SuggestionList %> ];
$( "#TextBox1" ).autocomplete(
{
source: availableTags,
autofocus: true,
select: function(event, ui) {
$("#TextBox1").val(ui.item.value);
}
});
});
推荐答案
(function()
{
var availableTags = [<%= SuggestionList%>];
(function()
{
var availableTags = [ <%= SuggestionList %> ];
(#TextBox1)。自动完成(
{
来源:availableTags,
autofocus:true,
select:function(event,ui){
( "#TextBox1" ).autocomplete(
{
source: availableTags,
autofocus: true,
select: function(event, ui) {
(#TextBox1)。 val(ui.item.value);
}
});
});
("#TextBox1").val(ui.item.value);
}
});
});
这篇关于jquery自动完成选择不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!