Bootstrap Data-picker, i want to disable previous dates

Posted by Gidijala.Dinesh under jQuery on 11/25/2014 | Points: 10 | Views : 1517 | Status : [Member] | Replies : 3
<script type='text/javascript'>
$(window).load(function () {

$('#<%=txtDOE.ClientID%>').each(function () {
var $picker = $(this);
$picker.datepicker();
var pickerObject = $picker.data('datepicker');
$picker.on('changeDate', function (ev) {
$picker.datepicker('hide');
});
});
});

</script>




Responses

Posted by: kgovindarao523-21772 on: 11/26/2014 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,
You want disable previous dates from which date?Is it Today?It would be better to give a brief descrption on your issue in the post.
Solution for disable previous dates before current date.
<script type='text/javascript'> 
$(window).load(function () {

$('#<%=txtDOE.ClientID%>').each(function () {
var $picker = $(this);
$picker.datepicker( {startDate: 'today',autoclose: true});
});
});
</script>
If this solution helps you, please mark as answer. If you have any queries revert back.

Thank you,
Govind

Gidijala.Dinesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gidijala.Dinesh on: 11/26/2014 [Member] Starter | Points: 25

Up
0
Down
ya tried,as you said.But didn't work

$picker.datepicker( {startDate: 'today',autoclose: true});

$picker.datepicker( {minDate:0});

these fucntions are not working in bootstrap datepickers...its working only in ui-datepickers

Gidijala.Dinesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: kgovindarao523-21772 on: 11/26/2014 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Its working fine for me using bootstrap-datepicker.
Try with below code.
$(document).ready(function () { 
$('#<%=txtDOE.ClientID%>').datepicker( {startDate: 'today', autoclose: true});
});


Thank you,
Govind

Gidijala.Dinesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response