Yesterday I mentioned how inexperienced developers can lean on code more than markup. Today I ran across an example of this. To start, we wanted an input for the start date.

<input type="date" name="start">

Next we wanted to set a default if it was not provided.


You may be asking, “Why not add value="2015-06-04" to the input element?” Well, if you don’t know about the value attribute, then the solution isn’t obvious, and a script will seem reasonable. But I would start by asking, “Can HTML already do this?”

Nicholas Lindley