Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove todays button from datepicker in JQuery?

I am new in jquery. I want to remove todays button from datepicker in Jquery. How to do that? I am using Jquery ui 1.8.10.

Regards, Girish

like image 603
Girish Chaudhari Avatar asked Apr 18 '11 05:04

Girish Chaudhari


3 Answers

use this style in your css file

button.ui-datepicker-current { display: none; }
like image 109
Gajendra Bang Avatar answered Nov 09 '22 03:11

Gajendra Bang


I have this:

$(".datepicker").datepicker({
        dateFormat: "yy-mm-dd",
        changeMonth: true,
        changeYear: true,
        yearRange: "c-150:c+30",
        showButtonPanel:true,
        closeText:'Clear',
        beforeShow: function( input ) {
            setTimeout(function () {
                $(input).datepicker("widget").find(".ui-datepicker-current").hide();
                var clearButton = $(input ).datepicker( "widget" ).find( ".ui-datepicker-close" );
                clearButton.unbind("click").bind("click",function(){$.datepicker._clearDate( input );});
            }, 1 );
        }
}).attr("readonly", true);

the line :

$(input).datepicker("widget").find(".ui-datepicker-current").hide();

hide the today button

like image 34
Luis Batista Avatar answered Nov 09 '22 03:11

Luis Batista


Working example on jsfiddle

Read more on docs.jquery.com

$(document).ready(function() {
  $("#datepicker").datepicker({
    "showButtonPanel":  false
  });
});
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" media="all" /> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script>
<input type="text" id="datepicker"/>
like image 14
Peeter Avatar answered Nov 09 '22 04:11

Peeter