Hodaya Shalom
Hodaya Shalom

Reputation: 4417

Android auto complete only after space?

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

I have an auto-complete input

On a computer auto-complete input works great!

In SmartPhone, the auto-complete 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").autocomplete({
                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>

Upvotes: 16

Views: 1437

Answers (4)

Hodaya Shalom
Hodaya Shalom

Reputation: 4417

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

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

I run the auto complete manually, and it works

Thank you all for the help

Upvotes: 2

A. Magalh&#227;es
A. Magalh&#227;es

Reputation: 1516

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

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

Upvotes: 2

sourcecode
sourcecode

Reputation: 1802

I am not sure ,but try after giving

     minlength :0

and execute the autocomplete on keypress

may be this will give u output.

have a look at these links also

  1. link1
  2. link2

Upvotes: 3

Raymond Camden
Raymond Camden

Reputation: 10857

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

Upvotes: 5

Related Questions