Message Boards

Alloy Datepicker: pre-populate selected date if trigger not an input elem.

Olga Ribeiro, modified 3 Years ago.

Alloy Datepicker: pre-populate selected date if trigger not an input elem.

New Member Post: 1 Join Date: 11/22/20 Recent Posts

How do I pre-populate a selected date on the datepicker calendar if the trigger is not an input element.

I've tried with a div and a button element as the triggers, and none worked. The "calendar.date" attribute doesn't seem to do the trick.

 

This is my code:

YUI().use(

    'aui-datepicker',

    function(Y) {

        var datePicker = new Y.DatePicker(

        {

            trigger: '#elemId',

            mask: '%d/%m/%Y',

            calendar: {

                date: new Date()

            },

            popover: {

                zIndex: 2001

            }

        });

    }

);

 

And my html is something of the sort: <div id="elemId"></div>

 

I've played around with the render event also, but still no luck.

 

Any suggestions?

Thanks in advance!