Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

iOS5 datepickers don't fire onchange #25

Open
paulirish opened this Issue · 2 comments

3 participants

@paulirish
Collaborator

Summary:

Mobile Safari on iOS5 does not fire the change event when a new date/time is selected with the native picker.

Platforms Affected:

  • iOS 5 Mobile Safari, incl iphone and ipad

Correct results

  • Chrome on Android tested, and it successfully fires change event
  • Opera Mobile also fires change event
  • (Android Browser on ICS doesn't have <input type=date> support so its moot there)

How to reproduce:

  1. select a date
  2. click elsewhere to commit the change
  3. change event never fires.

Reduced Example:

Bug Tracker ticket(s):

  • not filed

Workarounds:

  • The blur event fires, so you can bind to that instead. You'll probably want to bind to both and add some fancy logic to cancel out one of them.
@yahelc

For the workaround of using both blur and change, you could probably get around it by attaching a single event handler that unbinds when fired once. jQuery has $().one() for that

$("input[type='date']").one("blur change", function(){  
//will only execute once
 });

if you need to have the function execute more than once per DOM element ever, you could re-apply it with a setTimeout, to avoid the dual firing.

@akgrandhi

ios select elements don't seem to fire the change event either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.