Serhioromano / bootstrap-calendar

Full view calendar with year, month, week and day views based on templates with Twitter Bootstrap.
http://bootstrap-calendar.eivissapp.com/
MIT License
3.02k stars 1.29k forks source link

How can I get the clicked date? #758

Open lloyrdmart opened 6 years ago

lloyrdmart commented 6 years ago

How can i get the date that was clicked? I am new to the web dev world. Please teach me

tonspeed commented 4 years ago

I've made own workaround, not so pretty, but works: modyfy template day.html, add:

before this line:

<%= cal._hour(i, l) %>

in calendar: onAfterViewLoad: function(view) { $(\'.page-header h3\').text(this.getTitle()); $(\'.btn-group button\').removeClass(\'active\'); $(\'button[data-calendar-view="\' + view + \'"]\').addClass(\'active\'); //------------------------------------------------------------------------------- $(\'#cal-day-box #cal-day-panel #cal-day-panel-hour .cal-day-hour .row-fluid.cal-day-hour-part\').unbind(\'click\'); $(\'#cal-day-box #cal-day-panel #cal-day-panel-hour .cal-day-hour .row-fluid.cal-day-hour-part\').click( function() { //When click on hour in the day view var date = $(this).children(\'.dzien\').html(); var time = $(this).children(\'.span1\').children(\'b\').html(); NewEvent(date, time); }); },