简体   繁体   English

模态对话框中的jQuery UI自动完成组合框

[英]jQuery UI autocomplete combobox in a modal dialog

I want to use a autocomplete combobox http://jqueryui.com/demos/autocomplete/#combobox within a modal dialog. 我想在模式对话框中使用自动完成组合框http://jqueryui.com/demos/autocomplete/#combobox However whenever I click on the down arrow (of the combobox) it causes a refresh that results in my modal window closing. 但是,每当我单击(组合框的)向下箭头时,都会引起刷新,导致模态窗口关闭。

How do I stop the refresh from occuring? 如何停止刷新的发生? (I am still new to jQuery) (我还是jQuery的新手)

I am using UI 1.8 and jQuery 1.4.1. 我正在使用UI 1.8和jQuery 1.4.1。

The problem is discussed on the jQuery forum here: http://forum.jquery.com/topic/autocomplete-combobox-problem-when-it-is-placed-inside-a-form-tag 在jQuery论坛上讨论了此问题: http : //forum.jquery.com/topic/autocomplete-combobox-problem-when-it-is-placed-inside-a-form-tag

They suggest several different ways of adjusting the source code of the autocomplete combo to fix it. 他们提出了几种不同的方法来调整自动完成组合的源代码以进行修复。 The simplest one seems to be this: 最简单的一个似乎是:

Change the line that says 换行说

$("<button>&nbsp;</button>") 

to

$("<button type=\"button\">&nbsp;</button>")

this prevents the type="submit" from being inserted into the final button. 这样可以防止将type="submit"插入到最终按钮中。

好吧,我通过从组合框周围删除了表单标签来解决了自己的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM