Adding a line break in JavaScript (full calendar)

12,595

Solution 1

Like I already said in my answer above: adding a \n does the trick!

see: http://jsbin.com/IZoCoJIy/1/

Solution 2

eventRender and try to find a fc-title then append html

    events : [
                {
                    "title":"TCC-000004",
                    "id":"2",
                    "start":"2019-12-03 09:00:00",
                    "end":"2019-12-03 00:00:00",
                    "color":"#730058",
                    "status":"A",
                    "description":"Testing Description"
                }
            ],

    eventRender: function(event, element) {

        // To append if is assessment
        if(event.description != '' && typeof event.description  !== "undefined")
        {  
            element.find(".fc-title").append("<br/><b>"+event.description+"</b>");
        }
    }, 

Result Result

Share:
12,595
Millhorn
Author by

Millhorn

Full Stack Developer

Updated on June 04, 2022

Comments

  • Millhorn
    Millhorn almost 2 years

    This is from Adam Shaw's FullCalendar...

    How can I put a line break in here so that line two moves to the next line?

    events: [
        {
        title: 'Line 1 - This is line 2...',
        start: '2013-11-07'
    },
    

    I tried adding one of these, +'<br />', but it didn't work...

    Thoughts?

  • Millhorn
    Millhorn over 10 years
    7 more long minutes bud. Sorry... Thanks again.
  • Millhorn
    Millhorn about 10 years
    I need to see an example of what you're talking about. This calendar works fine for me. I'd also recommend opening up a new question. You're likely to get more answers that way. Respond to this comment with a link to the new question. Thanks.
  • KBriz
    KBriz about 10 years