How to put date of birth in an input date

1

Hello, what I want to do is that by clicking on the input the calendar that shows start in the year 1900 as the default but do not show the date in the input before selecting a date, try with value but that shows the date without having selected.

    
asked by Kevin 28.06.2017 в 15:14
source

2 answers

1

Here's an example with jQuery if you want to use Js:

$.datepicker.setDefaults($.datepicker.regional["es"]);
$("#datepicker").datepicker({
firstDay: 1
});

$("#datepicker").click(function () {
$("#datepicker").datepicker("setDate", "-117y");
});
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Año Fijo</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script src="jquery.ui.datepicker-es.js"></script>
</head>
<body>
Fecha:
<div >
<input id="datepicker"></input></div>
<hr />
</body>
</html>
    
answered by 28.06.2017 / 15:32
source
1

You must use onClick and at least one line of JavaScript. Example

<input id="fecha" type="date" onclick="this.value = '1900-01-01';"/>
    
answered by 28.06.2017 в 15:31