I am trying disable the left/right buttons that allow the user to change months. I've removed the drop down list of months but can't get rid of the buttons.
$("#date").datepicker({
changeMonth: false,
changeYear: false,
dateFormat: 'dd/mm/yy',
duration: 'fast'
});
DateRangePicker can be inactivated on a page, by setting enabled value as false that will disable the component completely from all the user interactions including in form post.
Syntax: $(". selector"). datepicker("hide");
In the Data type Format dialog box, do one of the following: To format the control to show the date only, select the display style that you want in the Display the date like this list. To format the control to show the time only, select the display style that you want in the Display the time like this list.
You can effectively disable them using stepMonths
by making them go nowhere when clicked, like this:
$("#date").datepicker({
changeMonth: false,
changeYear: false,
dateFormat: 'dd/mm/yy',
duration: 'fast',
stepMonths: 0
});
You can give it a try here
Or, you could remove the buttons like this:
$("#date").datepicker({
changeMonth: false,
changeYear: false,
dateFormat: 'dd/mm/yy',
duration: 'fast'
}).focus(function() {
$(".ui-datepicker-prev, .ui-datepicker-next").remove();
});
You can give that a try here, this works because the default showOn
option is focus
, if you're using a different event, just bind to that after the .datepicker()
call (so its event runs first, you can't hide what isn't created yet).
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