jQuery Datepicker

jQuery Datepicker

In this post jquery that attaches a popup calendar to your input fields or shows an inline calendar for selecting individual date range date.

<input id="defaultPopup" size="12">
$('#defaultPopup,#defaultInline').datepick(); 
 
$('.disablePicker').click(function() { 
    var enable = $(this).text() === 'Enable'; 
    $(this).text(enable ? 'Disable' : 'Enable'). 
        siblings('.is-datepick').datepick(enable ? 'enable' : 'disable'); 
});

set defaults

$.datepick.setDefaults({pickerClass: 'my-picker'});

Add the jQuery library in the head section of your page

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

Date format

$(selector).datepick({dateFormat: 'yyyy-mm-dd'});

Programatically, use the getDate method:

var date = $(selector).datepick('getDate');

 

2020-02-22