I'm trying to programmatically trigger the dropdown component (the calendar bit) of an input of type date (similar to clicking the down arrow on the input field). Is this possible? I don't want to use a datepicker library.
HTML:
<input type="date" id="myDatePicker">
<button id="myButton">Click Me</button>
JavaScript/jQuery:
$('#myButton').click(function(){
//$('#myDatePicker').click();//Doesn't do anything...
//$('#myDatePicker').blur();//Doesn't do anything...
//$('#myDatePicker').change();//Doesn't do anything...
//$('#myDatePicker').focus();//Doesn't do anything...
});
http://jsfiddle.net/joepegler/mvobkjcu/8/
Long story short it would appear that you can't. I used a datepicker instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With