Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery UI Datepicker - How to remove the "Done" button

I am using a Jquery datepicker. I want the button panel to be visible, but I do not want the "Done" button. According to the Jquery UI page here

Display a button for selecting Today's date and a Done button for closing the calendar with the boolean showButtonPanel option. Each button is enabled by default when the bar is displayed, but can be turned off with additional options.

What are the options for turning off the Done button? My code:

<script>
 $(function() {
  $( "#JourneyDate" ).datepicker({
        showButtonPanel: true,
        showWeek: true,
        maxDate: "+0",
        dateFormat: 'd MM yy',
        changeMonth: true,
        changeYear: true
    });
});
</script>

I tried accessing the button using selector ui-datepicker-close and calling remove() but that does not seem to work.

like image 270
escist Avatar asked Apr 24 '12 11:04

escist


2 Answers

You can do it with CSS;

button.ui-datepicker-close {display: none;}​
like image 198
Alex K. Avatar answered Nov 15 '22 22:11

Alex K.


$('<style type="text/css"> .ui-datepicker-close { display: none; } </style>').appendTo("head");
like image 45
BehranG BinA Avatar answered Nov 15 '22 21:11

BehranG BinA