0

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

2
  • Could anyone help on this please? Commented Mar 14, 2024 at 11:34
  • Can you add a more of an example that can be runnable, so others can assist? Use the <> icon on the text editor toolbar to create a stacksnippet. (like a fiddle) In the HTML section add the jquery from the left side of the page, and only the elements that would appear in the body. You'll likely need to add a CDN links for the datepicker needs to the HTML section as well. Commented Mar 16, 2024 at 16:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.