Datepicker With Custom btn

UI Datepicker with custom button, ui-datepicker-prev trigger click

by Amitabha Ghosh

HTML

<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<button id="p1">Previous</button>
<button id="n1">next</button>

<p><div id="datepicker"></div></p>

CSS

.ui-datepicker-prev{display:none;}
.ui-datepicker-next{display:none;}

JavaScript

$( "#datepicker" ).datepicker({
  
    numberOfMonths: [ 1, 4 ]
});

$("#p1").on('click',function(){
 $(".ui-datepicker-prev").trigger('click');
});

$("#n1").on('click',function(){
 $(".ui-datepicker-next").trigger('click');
});