Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
321 views
in Technique[技术] by (71.8m points)

javascript - Autocomplete requires you to click twice in iOS after update to 1.11.0

Using jQuery 2.1.0 and jQuery.ui 1.11.0 Tested in iOS 7. iPhone and iPad Mini. Works on android and regular browsers.

The problem

We recently upgraded from jQuery UI 1.10.0 to 1.11.0 and now, when clicking an item in an autocomplete results list, you only get a hover, you have to click the same element again to get a click event. This used to work fine with version 1.10.0.

(JSFiddle link in comments)

What does not work

using css {cursor: pointer} does not work

using onclick="" does not work

(JSFiddle link in comments)

The weird part

But here comes the fun/weird part. It works in JSFiddle edit view, but not on the JSFiddle "/show" page.

JSFiddles: (type a letter to show results "s" is a good one)

I've been working on this for days, but hadn't been able to reproduce it in JSFiddle before testing only the html view. So now I turn to you. I can't for the life of me figure out why the one page triggers a click event, and the other does not.

I am using the most basic function of jQuery autocomplete. In fact, using the exact same code that is presented on jQuery UI's home page.

The question

So, how do I get autocomplete to work with one click in iOS on the /show page?

(I will post additional links in comments because I don't have 10 rep yet. Unless I don't have enough rep to comment...)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Just a bit later, but

$("#input").autocomplete({
    open: function(event, ui) {
        $('.ui-autocomplete').off('menufocus hover mouseover mouseenter');
    }
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...