Search code examples
jquerydatepicker

show hide jquery datepicker calendar


For displaying jquery calendar with Month only I have used css as

   <style>
      .ui-datepicker-calendar 
      {
         display:none
      }
   </style>

But this CSS is applied to complete page and to other datepicker controls have become monthpicker . How do I restrict it to only one control.

    <input data-val="true" id="StartMonth" name="StartMonth" type="text" value="" /> 
    $('#StartMonth').focusin(function () 
    {
        $('.ui-datepicker-calendar').css("display", "none");
        $('#StartMonth').datepicker('setDate', new Date(year, month, 1)).trigger('change');
    });

Solution

  • With a little help of query u can achieve your desired result. Please follow the fiddle.

    http://jsfiddle.net/DBpJe/7376/

       $('#startDate').focusin(function(){
      $('.ui-datepicker-calendar').css("display","none");
    });