Sunday, March 6, 2011

How do I hide the next/today/previous navigation in jQuery DatePicker and turn off animations?

How do I hide the prev/today/next navigation in jQuery DatePicker?

I'm happy with just the Month and Year drop down boxes.

Also how do I disable the animations?

@tvanfosson - I already tried 'hideIfNoPrevNext' but that only works if you don't have a date range that spans two months. The duration option did the trick at turning off the animations though. Cheers.

Thanks
Kev

From stackoverflow
  • You can find the options for the DatePicker control at http://docs.jquery.com/UI/Datepicker/datepicker#options. Specifically, I think you want to set hideIfNoPrevNext to true and set duration to ''.

      $('#cal').datepicker( { hideIfNoPrevNext: true, duration: '' } );
    
  • You can hide prev/next navigation via css. You can see examples which do it in themes http://marcgrabanski.com/pages/code/jquery-ui-datepicker

    Kev : I eventually worked it out by fiddling with the CSS theme, but thanks for the answer.
  • Just hide buttons

    $("div.ui-datepicker-header a.ui-datepicker-prev,div.ui-datepicker-header a.ui-datepicker-next").hide();
    

0 comments:

Post a Comment