I have a HTML5 design where I want to be able to use a button to display a date, but I want to use the HTML5 input type="date" to select the date.
Here is my code:
<button type="button" id="btnDate" class="btn btn-primary">
<span class="glyphicon glyphicon-calendar"></span> <span class="date">27 Jul 2015</span>
</button>
<input type="date" class="hidden" id="tbDate" />
<script type="text/javascript">
$(document).ready(function() {
$("#btnDate").click(function () {
$("#tbDate").focus();
});
});
</script>
I've tried focus() and click() - neither work...any ideas?