jQuery date picker manual trigger

30 Views Asked by At

I have a working version of jQuery date picker, Just need to implement 2 more enhancements to it

enter image description here

enter image description here

  1. The calendar function is not invoking while clicking the Date Icon, however if I click the text field it works well. How to fix this?

  2. Clear to today's date button - This presets the date to today's
    date, but I want a click event to happen here because I'm calling an
    other function when a date change happens

    viewHistoricFund = function () {
        $('#historicDate').datepicker({
            changeMonth: true,
            changeYear: true,
            showButtonPanel: true,
            dateFormat: "dd MM yy",
            monthNames: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ],
            minDate:"-5y",
            maxDate: 'today',
            onSelect: function(selected,evnt) {
                showHistoricDate(selected);
            }
        }).datepicker("setDate", "0");
    },
    
    
    $("#clear-historic-date-button").click(function (e) {
        $("#historicDate").datepicker("setDate", new Date()); //Working
        $("#historicDate").trigger("click");  //Not working
        viewHistoricFund();  //Not working
    });
    

Could you please help to sort out this issue?

Appreciate your help

0

There are 0 best solutions below