0

I want to disable datepicker when clicking on radio button

<input 
  type="radio" 
  class="shwbtnrd" 
  required="required" 
  id="bookType" 
  name="bookType" 
  value="1" 
  checked="checked" 
  onclick="window.location='<?php echo $_SERVER['REQUEST_URI']; ?>';" 
/>

<input 
  name="dat" 
  id="dat" 
  required="required" 
  readonly="readonly" 
  placeholder="Date of Birth" 
  class="form-control"  
  type="text"  
/>

<script>
$(function () {
  $("#dat").datepicker({
    changeMonth: true,
    changeYear: true,
    yearRange: '-100:+0',
    dateFormat: 'yy-mm-dd',
    maxDate: new Date()
  });
});
</script>

If i click on radio button then need to disable bootstrap datepicker

1 Answer 1

0

Try below code to disable datepicker for input type

$("#dat").attr("disabled", true);

where dat is id of input type.

This code is working for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.