开发者

jQuery fullcalendar custom event

开发者 https://www.devze.com 2022-12-26 17:59 出处:网络
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...

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) {         
    console.log(element[0]);
}

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; ">
  <a>
    <span class="fc-event-bg">
    <span class="fc-event-time">10:30 - 11:30</span>
    <sp开发者_开发问答an class="fc-event-title">Primera vez que viene</span>
  </a>
  <div class="ui-resizable-handle ui-resizable-s">=</div>
</div>


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 );
}
0

精彩评论

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

关注公众号