WEB APP not native, no Objective-C
This is so simple it hurts.
<input type="date" />
Done to use the iPad native datepicker. Then setting the initial value with jQuery
$('input[type="date"]').val('Jun 25, 2012');
Resulting in an empty input field. The jQuery above works great in ie7-9, chrome, safari, and FF, but not in iOS!
I am out of ideas. Does anyone know a work around? Or why this happens?
Try this for Safari on iOS 5
$('input[type="date"]').val('yyyy-MM-dd');
You could do the conversion from the type of Date you are using to yyyy-MM-DD
in JavaScript using the Date()
function.
for iOS6 the ISO format "YYYY-MM-DDTHH:mm:ss.sssZ" is required:
var now = new Date().toISOString();
$("input[type=datetime]").val(now);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With