You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it is not the best (and most proper) way to do it, but you can do it like this:
Define months array before initialize eCalendar: var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
You can use this array later, as option of eCalendar: $('#calendar').eCalendar({ months: months });
After initialize eCalendar add jquery body onClick event.
$('body').on('click','#calendar .c-day',function(){
//get day from object you clicked
var day = $(this).html();
//get month and year from element, and split it to two values
var month_and_year = $('#calendar .c-month').html().split(' ');
//get proper index of array months, and add one, because array starts from 0
var month = months.indexOf(month_and_year[0]) + 1;
//get year
var year = month_and_year[1];
//show results in console
console.log(day + '/' + month + '/' + year);
});
As you see, I use "body on click", because other way, script won't work after month changes.
I scraped data, because elements does not supply any data by itself.
Hi,
how can I raise onClick event , when a user click on a date ?
The text was updated successfully, but these errors were encountered: