jquery keeping date picker open all the time

北战南征 提交于 2019-11-28 13:44:49

According to the documentation, you can call it on a div instead of an input and it will stay open and be inline. http://jqueryui.com/demos/datepicker/#inline

You could use it's onSelect event to handle when a date is selected.

If you are using the jQuery UI datepicker, use this:

http://jqueryui.com/demos/datepicker/#inline

You can then handle the click event and add the selected date to the text field.

I totally agree with @Corbin I would like to provide full example so that help someone in details.

If you want to to have jQueryui calendar default open also capture the click event of calendar follow bellow steps:

HTML Code:

  <div id="myDatePicker" class="DateBox datepicker" style="width:100%;height:200px;"></div>
  <input type="hidden" id="dateHidden" name="dateHidden" />

and your script should look like bellow:

<script>
  $( function() {
    $( ".datepicker" ).datepicker({ 
      altField: "#dateHidden",
      dateFormat: 'yy-mm-dd'})
     .datepicker("setDate", "0");
 } );
</script>

and you can get the selected value of date like bellow code:

<script>

   $("#dateHidden").on('input propertychange paste', function(){

      var Loc = $("#Cafe").val();
      var PDate = $("#dateHidden").val();
      //------Functions you call or actions you perform--------//
      //GetLoc(Loc,PDate);

 });

</script>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!