Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Native Date Picker in Html

I used Datepicker plugin for getting Calendar in HTML. But my boss ordered me not to t use any jquery plugins for date picker. He is saying that I must use native code only for date picker. It should work without Javascript also.

Is it possible to create native calendar in html ?

I know html5 supports native date picker; but that is not supported by all browsers.

Can i get native date picker as following style..?

enter image description here

like image 213
mani Avatar asked Nov 21 '25 10:11

mani


2 Answers

"Native" and "without JavaScript" is where this idea will not work on older browsers. You could always create an HTML5 datepicker, and non-supportive browsers will fallback to a plain textbox. You could instruct the user to enter a date in MM/DD/YYYY format, and have this format applied by the datepicker, or by hand if the datepicker is unavailable.

This page offers some advice on the HTML5 datepicker: http://html5tutorial.info/html5-date.php

Edit: Alternatively, you could just create three dropdown menus and have the user select the month, day, and year. (Of course without JS in this case, you couldn't have the number of days in a month change with the user's choice, but you could always validate their input on the server.)

like image 179
Oliver Spryn Avatar answered Nov 23 '25 02:11

Oliver Spryn


You could instruct the user to enter a date in MM/DD/YYYY format, spryno724

This, a simple html5 placeholder (you can also style css placeholder) would suffice.

<input type='text' placeholder='dd/mm/yyyy' name='form[datetime]' id='datetime' />
like image 44
classicjonesynz Avatar answered Nov 23 '25 02:11

classicjonesynz