jQuery UI autocomplete combobox in a modal dialog

北战南征 提交于 2019-12-11 13:51:22

问题


I want to use a autocomplete combobox http://jqueryui.com/demos/autocomplete/#combobox within a modal dialog. 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)

I am using UI 1.8 and jQuery 1.4.1.


回答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

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.




回答2:


Ok I fixed my own problem by removing the form tag from around the combobox



来源:https://stackoverflow.com/questions/2535240/jquery-ui-autocomplete-combobox-in-a-modal-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!