开发者

How can i trigger clicking of the "today" button by code?

开发者 https://www.devze.com 2023-02-19 10:32 出处:网络
Ho开发者_Go百科w can i trigger clicking of the \"today\" button by code in FullCalendar? If I where to this by an external button?http://arshaw.com/fullcalendar/docs/current_date/today/You have access

Ho开发者_Go百科w can i trigger clicking of the "today" button by code in FullCalendar? If I where to this by an external button?


http://arshaw.com/fullcalendar/docs/current_date/today/


You have access to fullCalendar, so you can do something like this:

$('#external-button').on('click', function() {
    $('#calendar').fullCalendar('today');
}); 


Without actually looking at the code, I would assume that the "Today" button is hooked to a JQuery or Javascript method within the FullCalendar code. Just call that method.


In case the documentation URL posted above goes dead...

Moves the calendar to the current date.

.fullCalendar( 'today' )

Example using today with an external button:

$('#my-today-button').click(function() {
    $('#calendar').fullCalendar('today');
});
0

精彩评论

暂无评论...
验证码 换一张
取 消