最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Android auto complete only after space? - Stack Overflow

programmeradmin6浏览0评论

I have an application built in Html5 and wrapped in PhoneGap for Android

I have an auto-plete input

On a puter auto-plete input works great!

In SmartPhone, the auto-plete works only after you make space on the Input

(If write numbers first - works! If letters - works only after space)

Why?

JS code:

//Run in document.ready
function AutoComplete() {
    List = $.map(data.XXX, function (item) {
                return {
                    label: item.X,
                    value: item.XX
                };

            });
    $("#MyInput").autoplete({
                source: List,
                link: '#',
                target: $('#MyList'),
                minLength: 1
            });

   }

HTML:

The input:

 <input id="MyInput" type="text" 
                placeholder="XXX"  />

The List:

  <ul id="MyList" data-role="listview" data-inset="true"> </ul>

I have an application built in Html5 and wrapped in PhoneGap for Android

I have an auto-plete input

On a puter auto-plete input works great!

In SmartPhone, the auto-plete works only after you make space on the Input

(If write numbers first - works! If letters - works only after space)

Why?

JS code:

//Run in document.ready
function AutoComplete() {
    List = $.map(data.XXX, function (item) {
                return {
                    label: item.X,
                    value: item.XX
                };

            });
    $("#MyInput").autoplete({
                source: List,
                link: '#',
                target: $('#MyList'),
                minLength: 1
            });

   }

HTML:

The input:

 <input id="MyInput" type="text" 
                placeholder="XXX"  />

The List:

  <ul id="MyList" data-role="listview" data-inset="true"> </ul>
Share Improve this question edited Dec 20, 2012 at 12:06 dilix 3,8933 gold badges33 silver badges58 bronze badges asked Dec 20, 2012 at 11:31 Hodaya ShalomHodaya Shalom 4,41713 gold badges60 silver badges115 bronze badges 4
  • it probably conflicts with the auto plete in the android keyboard – Stephan Celis Commented Dec 20, 2012 at 11:49
  • 1 You got me then. Maybe try adding it to the <form> tag as well. – Raymond Camden Commented Dec 20, 2012 at 15:45
  • 1 I do not have a tag <from>, and I did not understand what to add to this tag .. – Hodaya Shalom Commented Dec 23, 2012 at 6:34
  • 1 In Android, auto plete text view has android:pletionThreshold property to set. Android wouldn' t start auto pletion until this threshold reached. I know you are not using Android' s auto plete text view, but your problem must be something related to this fact. I think you should try setting this parameter somewhere. – Alpay Commented Jan 4, 2013 at 14:04
Add a ment  | 

4 Answers 4

Reset to default 5

Try adding autoplete="off" to the input tag.

I am not sure ,but try after giving

     minlength :0

and execute the autoplete on keypress

may be this will give u output.

have a look at these links also

  1. link1
  2. link2

I think this link solves your issue showing how to Getting jQueryUi Autoplete to work with jQueryMobile

This answer allows you to use autoplete function of jQuery on jQueryMobile solutions.

'oninput' event in the input, ran the following function:

function RefreshAutoComplete(elm) {
    elm.keyup();
    elm.focus();
}

I run the auto plete manually, and it works

Thank you all for the help

发布评论

评论列表(0)

  1. 暂无评论