JavaH
JavaH

Reputation: 427

issue in masked input textbox in android 4.0

I have developed a Phonegap app for Android, and I have a problem in Android 4.0.

When entering a number on the masked input textbox, the keyboard does not remain numeric. It keeps switching back to alpha characters, which makes it difficult to type a number because it automatically changes the keyboard display after each digit.

It's working fine in Android 2.2.

Here is my JS code:

<script type="text/javascript" src="js/jquery.maskedinput-1.3.js"></script>

    $(document).ready(function()
        if($("#text").length==1)
        {
            $("#text").mask("(999) 999-9999");
        }
    });

</script>

My HTML:

<input type="text" id="text">

Upvotes: 3

Views: 1161

Answers (3)

Semmerket
Semmerket

Reputation: 83

1 - Update masked-input to at least version 1.4
2 - Add type="tel" to the input, to trigger the phone keypad
3 - Remove the input's maxlength attribute or set it to a value certain not to interfere with the caret action, like 20.

Upvotes: 0

Nizar
Nizar

Reputation: 1526

Changing to input type to 'text' is the correct fix.

Upvotes: 0

isaac weathers
isaac weathers

Reputation: 1472

You need to change type to number. Or if you are using html5 for mobile you can use type="tel" to get ten digit keypad on mobile. Be careful though, this causes issues on Android.

Try input type="number" id="youShouldMakeThisUnique"

http://www.w3schools.com/html/html5_form_input_types.asp

Upvotes: 2

Related Questions