JQuery UI自动完成框在按Enter键时不会提交
我使用autocomplete with,当用户在文本框中键入时,会显示一个自动完成的国家名称,提交时用户会转到指定的URL 问题是,当用户点击提交按钮时,它就起作用了,但当用户按下回车键或使用iOS键盘上的“Go”按钮时,它就不起作用了JQuery UI自动完成框在按Enter键时不会提交,jquery,forms,autocomplete,Jquery,Forms,Autocomplete,我使用autocomplete with,当用户在文本框中键入时,会显示一个自动完成的国家名称,提交时用户会转到指定的URL 问题是,当用户点击提交按钮时,它就起作用了,但当用户按下回车键或使用iOS键盘上的“Go”按钮时,它就不起作用了 <head> (function($){ $(function(){ $('select').selectToAutocomplete(); }); })(jQuery) </head> <body>
<head>
(function($){
$(function(){
$('select').selectToAutocomplete();
});
})(jQuery)
</head>
<body>
<form class="countryform" name="countryform">
<select name="Country" id="country-selector" autofocus="autofocus" autocorrect="off" autocomplete="off" placeholder="Type your country" style="width:50%;" >
<option value="" selected="selected"></option>
<option value="http://www.qmul.ac.uk/international/international-students/countries/other/index.html" data-alternative-spellings="ZM">Zambia</option>
<option value="http://www.qmul.ac.uk/international/international-students/countries/Zimbabwe/index.html" data-alternative-spellings="ZW">Zimbabwe</option>
</select>
<input type="button" onclick="window.open(this.form.Country.options[this.form.Country.selectedIndex].value,'_top')" value="Submit">
</body>
(函数($){
$(函数(){
$('select')。选择自动完成();
});
})(jQuery)
赞比亚
津巴布韦
我怀疑标签中的onclick需要更聪明一点。我试着通过jQuery提交表单,但不起作用。有人帮我吗
谢谢使用onclick='window.open(this.form.Country.options[this.form.Country.selectedIndex].value,“\u top”)”,然后是你的下一个代码对不起,我不知道你所说的“下一个代码”是什么意思,你能澄清一下吗?ThanksUSE=>onclick='window.open(this.form.Country.options[this.form.Country.selectedIndex]。值,而不是倒数第二行的值,恐怕不起作用。实际上破坏了密码。