javascript - jQuery to fetch time from full calendar -
i want manually input time in modal , everytime modal pops time input field has value current time in computer's clock.
how edit javascript not generate time automatically. used plug in here https://github.com/tliokos/jquery-fullcalendar-crud . downloaded it. way first time use plug in.
this javascript code:
$(function(){ var currentdate; // holds day clicked when adding new event var currentevent; // holds event object when editing event $('#color').colorpicker(); // colopicker $('#time').timepicker({ minutestep: 5, showinputs: false, disablefocus: true, showmeridian: false }); // timepicker // fullcalendar $('#calendar').fullcalendar({ timeformat: 'h(:mm)', header: { left: 'prev, next, today', center: 'title', right: 'month, basicweek, basicday' }, // events stored in database events: 'crud/getevents.php', // handle day click dayclick: function(date, event, view) { currentdate = date.format(); // open modal add event modal({ // available buttons when adding buttons: { add: { id: 'add-event', // buttons id css: 'btn-success', // buttons class label: 'add' // buttons label } }, title: 'add event (' + date.format() + ')' // modal title }); }, // event mouseover eventmouseover: function(calevent, jsevent, view){ var tooltip = '<div class="event-tooltip">' + calevent.description + '</div>'; $("body").append(tooltip); $(this).mouseover(function(e) { $(this).css('z-index', 10000); $('.event-tooltip').fadein('500'); $('.event-tooltip').fadeto('10', 1.9); }).mousemove(function(e) { $('.event-tooltip').css('top', e.pagey + 10); $('.event-tooltip').css('left', e.pagex + 20); }); }, eventmouseout: function(calevent, jsevent) { $(this).css('z-index', 8); $('.event-tooltip').remove(); }, // handle existing event click eventclick: function(calevent, jsevent, view) { // set currentevent variable according event clicked in calendar currentevent = calevent; // open modal edit or delete event modal({ // available buttons when editing buttons: { delete: { id: 'delete-event', css: 'btn-danger', label: 'delete' }, update: { id: 'update-event', css: 'btn-success', label: 'update' } }, title: 'edit event "' + calevent.title + '"', event: calevent }); } }); // prepares modal window according data passed
suggest looking @ docs timepicker. https://jdewit.github.io/bootstrap-timepicker/
in case set defaulttime=false
defaulttime 'current' (default) - set current time. set specific time - '11:45 am' false - not set default time
Comments
Post a Comment