jQuery UI Autocomplete autoFocus not working

不打扰是莪最后的温柔 提交于 2019-12-05 04:50:24

You're using an old version of jQueryUI (1.8.9). The option works fine with 1.8.16. In fact, according to the changelog, the autoFocus option was added in 1.8.11, so you should be good with any version >= 1.8.11.

See an updated example using 1.8.16: http://jsfiddle.net/Bqujj/

Ashraf Maher

Open Jquery-ui.js file and search for "autocomplete". Change "autoFocus" to "true". e.g.

$.widget ( "ui.autocomplete", {
   version: "1.12.1",
   ...
   ...
   options: {
      ...
      ...
      autoFocus: true,
      ...
      ...

Screen shot of config

java_dev

keep autoFocus = true, before source option. eg like below.

$("#autocomplete").autocomplete({
    **autoFocus : true,**
    source: [
        "ActionScript",
        "AppleScript"
    ]
})
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!