Use Datepicker in HTML page is very simple, It is a input field of a from, to use Datepicker you will be use to bootstrap CSS and JS file, that are connect in you page and set Datepicker CSS file and JS file in the page, then use it.
It use in the form for set user Date of Birth and set current date.
I will help with example code, that is I will give you in below of page. So follow the example code and try it.
CSS and JS File:
<link rel=”stylesheet” href=”css/datepicker.css”>
<script src=”js/bootstrap-datepicker.js”></script>
Date Input Field:
<div id="datepicker" class="form-group" data-date-format="yyyy-mm-dd"> <input class="form-control" type="text" readonly name="date_of_birth"/> <span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span> </div>
Use the script for get the date:
<script type="text/javascript"> $(function () { $("#datepicker").datepicker({ autoclose: true, todayHighlight: true }).datepicker('update', new Date());; }); </script>
Question and answer is powered by AnsPress.io