Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Next in Jquery datepicker

Is there any other way by which I cannot allow the user to select next months. I had gone through some threads but I don't want to disable both next and previous buttons by using step functionality as directed in this link.

 function bindPicker() {
        $("input[type=text][id*=Date]").datepicker({
            changeMonth: true,
            changeYear: true,
            yearRange: "-100:+0",
            showOn: "both",
            buttonImage: "../../images/Calender.png",
            buttonImageOnly: true,
            dateFormat: "M-yy"
        });
    }
like image 374
JulyOrdinary Avatar asked Dec 21 '22 07:12

JulyOrdinary


2 Answers

Well if you are looking to simply remove the next/previous options and only use a forced month in your code, you can use CSS.

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

This will just remove the next/prev buttons all together. Then if need be you can even put in like some .toggle() code to show/hide them when needed.

like image 92
M.Hoover Avatar answered Jan 13 '23 13:01

M.Hoover


Try setting the maxDate option to 0, this set the max date to +0 days from today.

$(".datepicker").datepicker({maxDate: '0'});

More info: http://api.jqueryui.com/datepicker/#option-maxDate

like image 24
Benjamín Martínez Avatar answered Jan 13 '23 13:01

Benjamín Martínez