Inputting dates
Before HTML5 we were forced into creating custom controls that always had some missing features or were not compatible with some browsers. Now, there are separate input types for dates, and in this recipe we will see how to use them. They are unfortunately still not fully implemented across various user agents, but then everyone is slowly catching up.
How to do it...
We will simply create a basic HTML document and create a form in the body element:
First in the body section add
form
and inside it adate input
element:<form> <label> Select date <input name="theDate" type="date"> </label>
Similarly we add an input element for
month
andweek
:<label> Select month <input name="theMonth" type="month"> </label> <label> Select week <input name="theWeek" type="week"> </label>
At the end we add a simple
submit
and close theform
:<input type="submit" /> </form>
How it works...
Depending on your browser's...