我有一个输入框和一个隐藏的div。输入框是只读的。当用户点击输入框时,会使用JQuery UI自动完成提供一系列项目。我想要但无法实现的是,当用户从列表中选择一个项目时触发一个事件(删除隐藏类)。希望有人能帮助。谢谢您提前的回复。马克。
http://jsfiddle.net/fdBHC/1/
我的html:
我的html:
<input id="conditions" type="text" readonly="readonly" /input>
<div id="test" class="hidden">some text</div>
我的 CSS:
input{
margin:50px;
border:1px solid black;}
div{
width:200px
height:200px;
background-color:orange;}
.hidden{
display:none;}
我的js:
$(function() {
var availableTags = [
"aucune","Prise de contact préalable nécessaire"
];
$("#conditions").autocomplete({
source: availableTags,
minLength: 0
}).click(function() {
$(this).val("");
$(this).autocomplete("search");
});
});