Jquery keep date picker open all the time

Normal datepicker behavior should open when the texbox is clicked and close when the date is selected (pressed). I need to do this in order to open it from the form download and allow the user to click again. I am handling the click event

thanks

+4
source share
3 answers

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

You can use it onSelect to handle events when a date is selected.

+9
source

If you are using 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 box.

+2
source

I totally agree with @Corbin I would like to provide a complete example to help someone in detail.

If you want the jQueryui default calendar to be open, also record the click event for the calendar, follow these 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 this:

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

and you can get the selected date value, for example, the following 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> 
0
source

Source: https://habr.com/ru/post/1386668/


All Articles