Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 466.5k

select checboxfor to call datepicker with time in jquery?

Aug 21 2020 5:01 AM
Hi Team
 
I have a checkboxfor, but i want to select it using jquery to call datepicker. How do i achieve such from below meaning it must have time?
  1. <div class="form-check">    
  2.        <div class="col-xl-2">    
  3.               @Html.CheckBoxFor(model => model.Lockuntil, new { @class = "form-check-input" })    
  4.                <label class="form-check-label" for="@Html.IdFor(model=>model.Lockuntil)">Lockuntil</label>    
  5.         </div>    
  6. </div>    
  7.     
  8. $( "#datepicker" ).datepicker({    
  9.       regional: "da",    
  10.       constrainInput: true,    
  11.       showWeek: true,    
  12. showTime:true // allowed?    
  13. });    
  14.     
  15. $("#dataLocker").change(function() {    
  16.     if(this.checked) {    
  17.         $("#datepicker").prop("disabled",false);    
  18.     }else{    
  19.         $("#datepicker").prop("disabled",true);    
  20.     }    
  21. }); 

Answers (1)