2

Chrome on Android

I am having trouble switching between two inputs. The HTML is simply

<input type="text"/> 
<input type="text"/>

When I type text into the first input and then click on the second input the on screen keyboard goes away. This makes me have to click on the second input again in order to show the keyboard. It is really annoying.

I have tried giving them a tabindex but that didn't help. I also tried putting them into a form and that didn't help.

Here is a fiddle showing the problem. http://jsfiddle.net/k9bnd2gy/4/show/

2
  • I tried this fiddle in my moto e 2nd gen (lollipop) and works fine. It would be easier to identify the issue if you provide more information. Commented May 1, 2015 at 5:59
  • 1
    @muhammedbasil I was able to reproduce it on three different phones including my Nexus 5. The trick is that you have to put text into the first input before clicking on the second input in order to show the bug. Commented May 1, 2015 at 15:13

1 Answer 1

3

I was able to solve this by using setSelectionRange when the focus event is fired.

This works because it forces the cursor into the input.

$('input').on('focus',function(event){
    this.setSelectionRange(0, 0);  
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.