8

I am using jQuery mobile 1.1.0. I have a form where the user can edit information. In that form are 2 fields with date values. Since I want to leverage the built in date picker functionality, the input type is set to "date". When the form loads on a desktop browser the value is set properly with a date, however when I view the same form on my mobile device (iPhone iOS 5), the date fields are not populated.

Below is one field, with the type="text". The value gets set fine:

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

$("#name").val(obj.Name);

The date field (type="date") never gets a value set:

<input type="date" id="startdate" />

$("#startdate").val(obj.StartDate);

As stated, on a desktop browser (Chrome/Firefox), the fields get a value set. It's on the Safari mobile that it doesn't.

If this has already been answered somewhere please excuse me! I've searched but haven't found anything related.

1

1 Answer 1

11

I found the answer from another post: Setting the value of date inputs on iPad

It's simply a matter of formatting the date to yyyy-MM-dd, it's that simple.

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.