Paul Grenyer
Paul Grenyer

Reputation: 1843

JQuery in "keyup change keypress click tap" not firing on iPhone (IoS)

I've got a JQuery based web application which is intended to work on the desktop and on mobile. I have an input field:

<input id="account_id" name="account_id" type="text" class="form-control" pattern="^[A-Za-z0-9]{2}-[0-9]{4}-[0-9]$" maxlength="9" style='text-transform:uppercase' required></input>

<button name="search" id="search" type="button" class="btn btn-primary pull-right width-40" disabled>Search</button>

which I want to be validated as the user types so that when they have entered valid input the search button shows before they have to click "done" on the keypad or move away from the input:

me.accountIdBox().on("keyup change keypress click tap",function() {
    me.onChangeAccountId();
  })

It works fine on an iPad with IOS 10.3, but not on an iPhone with the same.

It doesn't work on an iPhone or an iPad with IOS 12.1.x - except on the iPad with an external keyboard.

Any idea what the issue is here?

Upvotes: 0

Views: 121

Answers (1)

Illizian
Illizian

Reputation: 532

It appears the events you're tracking are covered by the input event. You should refactor to listen to this single event instead, as follows:

me.accountIdBox().on("input", function() {
  me.onChangeAccountId();
});

Upvotes: 1

Related Questions