Luger33
Luger33

Reputation: 43

Remove the default date in jquery datepicker

My datepicker jQuery I need to delete the default day so I removed the class. Are there another solution?

$('#calendar .ui-datepicker-days-cell-over').removeClass('ui-datepicker-days-cell-over');
$('#calendar .ui-state-hover').removeClass('ui-state-hover');
$('#calendar .ui-datepicker-current-day').removeClass('ui-datepicker-current-day');
$('#calendar .ui-state-active').removeClass('ui-state-active');

Upvotes: 4

Views: 24901

Answers (5)

poppies
poppies

Reputation: 120

You can try:

$( "#datepicker" ).datepicker('setDate', null);

Upvotes: 0

user6771308
user6771308

Reputation: 1

<script>
    $("#datepicker").focus ( function(){
        $( "#datepicker" ).datepicker();
    });
</script>

Change date picker action from on load to on click or on focus so that function will stop generate date on page load, with this default place holder will display.

Change script with bellow updates.

Upvotes: 0

user6771308
user6771308

Reputation: 1

Change date picker action from on load to on click or on focus so that function will stop generate date on page load, with this default place holder will display.

change script with bellow updates.

<script>
  $("#datepicker").focus ( function(){
    $( "#datepicker" ).datepicker();
  });

Upvotes: 0

JAIGANESH
JAIGANESH

Reputation: 87

 <!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>jQuery UI Datepicker - Default functionality</title>
      <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
      <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
      <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
      <style type="text/css">
       .ui-datepicker-calendar .ui-datepicker-days-cell-over.ui-datepicker-today a
       {
        background: #e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") repeat-x scroll 50% 50% !important;
        border: 1px solid #d3d3d3 !important;
        color: #555555 !important;
       }

      </style>
      <script>
      $(function() {
        $( "#datepicker" ).datepicker();
      });

      </script>
    </head>
    <body>

    <p>Date: <input type="text" id="datepicker"></p>


    </body>
    </html>

Upvotes: 0

Qianyue
Qianyue

Reputation: 1777

By default, the default day is set to null. I don't know why your default day is set to another day. But you can reset it to null by:

$( "#datepicker" ).datepicker({
  defaultDate: null
});

See this jsFiddle.

Upvotes: 3

Related Questions