我已经在我的网页上使用jquery自动完成了一段时间,但是在从1.8rc3更新jquery ui到版本1.8.6后,自动完成ul对象现在被附加到正文而不是直接在给定的选择器之后.
下面的代码当然无效,它只是突出了我的问题.
在1.8rc3
$("#myinput").autocomplete(.....
<input id="myinput"/>
<ul id="autocomplete"></ul>
<div>Loads of other content</div>
<div>Loads of other content</div>
<div>Loads of other content</div>
</body>
Run Code Online (Sandbox Code Playgroud)
在1.8.6
$("#myinput").autocomplete(.....
<input id="myinput"/>
<div>Loads of other content</div>
<div>Loads of other content</div>
<div>Loads of other content</div>
<ul id="autocomplete"></ul>
</body>
Run Code Online (Sandbox Code Playgroud)
所以我的问题是,有没有办法让自动完成在我给定的选择器之后附加而不是附加到正文?
gro*_*gor 14
你可以使用选项"appendTo"
$("#input").autocomplete({
appendTo: $("#input").next()
});
Run Code Online (Sandbox Code Playgroud)
但是,这只能附加到您怀疑的某个容器中.如果您希望能够在输入后立即附加自动完成,那么您必须直接调整自动完成源(更改appendTo()for after())
| 归档时间: |
|
| 查看次数: |
20584 次 |
| 最近记录: |