raulriera raulriera - 1 year ago 186
jQuery Question

jQuery fullcalendar custom event

I was wondering how to apply a custom render to a event... I want to be able to prepend the "patient" name of a practice agenda...

eventRender: function(event, element) {

This currently shows the HTML output in the console, but I don't know how can I access it (in a pretty jQuery manner) in order to manipulate the data within.

The output of the console dump is

<div class="fc-event fc-event-vert fc-corner-top fc-corner-bottom dr1" style="position: absolute; z-index: 8; top: 104px; left: 403px; width: 155.7px; height: 40px; ">
<span class="fc-event-bg">
<span class="fc-event-time">10:30 - 11:30</span>
<span class="fc-event-title">Primera vez que viene</span>
<div class="ui-resizable-handle ui-resizable-s">=</div>

Answer Source

Did you try doing this?

eventRender: function(event, element) {         
 // get your new title somehow
 var title = "New Content";
 // replace the event title
 element.find('.fc-event-title').text( title );

Edit: Oh and if you just want to prepend, then change it to something like this:

eventRender: function(event, element) {         
 // get the name somehow
 var name = "Joe";
 // prepend the name
 element.find('.fc-event-title').prepend( name + ' - ' + title );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download