I have a display problem in the jQuery autocomplete inside a modal dialog bootstrap.

When I mouse scroll, the results do not remain attached to the input.

Is there a way to solve this?

这里是JsFiddle:

.ui-autocomplete-input {
  border: none; 
  font-size: 14px;
  width: 300px;
  height: 24px;
  margin-bottom: 5px;
  padding-top: 2px;
  border: 1px solid #DDD !important;
  padding-top: 0px !important;
  z-index: 1511;
  position: relative;
}

EDIT

.ui-autocomplete {
  position: fixed;
  .....
}

If the modal has scroll the issue remains!

Here JsFiddle/1.

推荐答案

The position is right that it is "absolute", while you need to specify this as an option to autocomplete:

$( ".addresspicker" ).autocomplete( "option", "appendTo", ".eventInsForm" );

Where it can anchor the box with the results in any element, I have to stop it from being anchored to the form's class!

Here is a working JsFiddle!.

Jquery相关问答推荐

如何在for循环期间上传文件

为什么我不能在 window.onload 事件的处理程序中将 $ jQuery 对象作为参数传递?

jQuery单击/切换两个功能

为什么我的 toFixed() 函数不起作用?

如何使用 jQuery 以编程方式触发对链接的点击?

jQuery Keypress 箭头键

不使用插件的 jQuery 缓动函数

jQuery获取表单字段值

jQuery scrollTop 在 Chrome 中不工作但在 Firefox 中工作

Jquery查找所有以字符串开头的ID?

jquery获取帖子操作网址

删除索引后的所有项目

使用 jQuery 获取选定的选项 id

使用 jQuery 拖放防止单击事件

Bootstrap 折叠动画不流畅

jQuery .hasClass() 与 .is()

jQuery select2 获取 Select 标签的值?

带有 LIKE 的 Spring JPA @Query

删除所有以某个字符串开头的类

IE 中带有 jQ​​uery ajax 调用的无传输错误