JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://cloud.github.com/downloads/digitalBush/jquery.maskedinput/jquery.maskedinput-1.3.js"></script>
<input type="text" id="dtp" />
<a href="javascript:;" id="Shower">Show</a>
JavaScript
$("#dtp")
.mask("9999/99/99")
.datepicker({ dateFormat: 'yyyymmdd',
onClose: function(dateText, inst) {
var res = dateText.substring(4, dateText.length);
res = res.substring(0, 4) + "/" + res.substring(4, 2) + "/" + res.substring(6, res.length);
$("#dtp").val(res);
}
});
$("#Shower").click(function() {
alert($("#dtp").val());
});