disable previous dates in calendar in jQuery

disable previous dates in the calendar when the User Select the dates from the calendar

 $(function(){

                var dtToday = new Date();


                var month = dtToday.getMonth() + 1;

                var day = dtToday.getDate();

                var year = dtToday.getFullYear();

                if(month < 10)

                    month = '0' + month.toString();

                if(day < 10)

                day = '0' + day.toString();

                var maxDate = year + '-' + month + '-' + day;

                $('input[name=event_date]').attr('min', maxDate);

            });

Sign In or Register to comment.