HTML5 date field and placeholder text in Safari
The iPad is doing the correct thing. The placeholder
attribute isn't supported on input
elements on type date
. It's probably working on desktop Safari because that doesn't support the date
type, so that attribute is being ignored and you're left with a plain text field. You could check in the DOM inspector.
Slight hack bit here goes...
Initially have the field as a text field. When the user focuses on the field switch the fields type to date and re-focus.
tested in ios6
HTML
<input type="text" placeholder="DOB" id="dob" />
JS
<script>
var textbox = document.getElementById('dob')
textbox.onfocus = function (event) {
this.type = 'date';
this.focus();
}
</script>