Jquery datepicker - only day and month

Viewed 47565

I want the user to specify their birthday or anniversary date (without year) in a form. For this, I want to use jquery datepicker but it should not show any year option at all. How to do it?

I tried modifying the code in this so question by making changeDay: true and changeYear: false but could not get it to work.

7 Answers
$( function() {
     var date = $('#datepicker').datepicker({
        dateFormat: 'yy-mm-dd',
        changeMonth: true, 
        changeYear: false}).val();
});

I may be late on the show but I found all of the above answers/suggestions and comments to be almost correct but someone might miss the correct jquery plugin to make the code work.

Someone struggling to make it done pls consider changing your javascript plugins first, and use the following instead


<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.12.4.js"></script>
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
Related