HTML5 input type date disable dates before today -
is there way disable dates before today in html5 <input type="date">
? tryed with: <input type="date" min="<?php echo $today; ?>">
works on desktop browsers...safari mobile still allow scrolling dates before.
input date must in iso format (which supported mobile browsers).
there no possible way pure html5.
but javascript, can like:
<input name="settodaysdate" type="date">
and;
var today = new date().toisostring().split('t')[0]; document.getelementsbyname("settodaysdate")[0].setattribute('min', today);
this little script change min
today's date in iso format.
live example here: jsfiddle
Comments
Post a Comment