Reputation: 835
How can i display a datepicker in a div on document.ready() without onclick of input tag?
<div id="return_datepicker"></div>
my js -
$("#return_datepicker").datepicker();
$("#return_datepicker").datepicker("setDate", new Date());
$("#return_datepicker").datepicker('show');
Upvotes: 0
Views: 55
Reputation: 765
You need to call the initialization of datepicker in IIFE. Try below code -
$(function() {
$("#return_datepicker").datepicker();
$("#return_datepicker").datepicker("setDate", new Date());
$("#return_datepicker").datepicker('show');
});
For more detail see JQuery UI docs
Upvotes: 1