0

My View:

<input type="text" class="datepicker" placeholder="DD/MM/YYYY" id="datepicker" ng-model="datepicker" name="datepicker" style="width:100%" tabindex="4"  required/>`  
Controller:  
  `$('#datepicker').datepicker({
 format: 'mm-dd-yyyy',
 endDate: '+0d',
 autoclose: true
 });

it's showing TypeError: $(...).datepicker is not a function

I want to disable all the future dates after today
Trying to implement.

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
Pavan
  • 15
  • 7

3 Answers3

1

as others have mentioned you might have not included it in your page...and as far as logic concerned for disabling dates after today:

You can assign today to maxDate option of datepicker,

this is what jquery datepicker api docs have about maxDate option

The maximum selectable date. When set to null, there is no maximum.

$(function(){

  $('#thedate').datepicker({
      dateFormat: 'dd-mm-yy',
      maxDate: new Date()
  });

});

Here is the fiddle hope your issue is resolved now

Mukul Jain
  • 1,121
  • 11
  • 24
0

Use maxDate instead of endDate

<input type="text" class="datepicker" placeholder="DD/MM/YYYY" id="datepicker" ng-model="datepicker" name="datepicker" style="width:100%" tabindex="4"  required/>`  

$('#datepicker').datepicker({
 format: 'mm-dd-yyyy',
maxDate: new Date(),
 autoclose: true
 });

Fiddle

0
data-plugin-datepicker data-plugin-options='{"autoclose": true, , "endDate": "0d", "format": "dd-mm-yyyy"}'

try this in html

MaoStream
  • 188
  • 9