Skip to content Skip to sidebar Skip to footer

How To Check For Empty Event.description (google Calendar Feed)?

I'm using the latest version of FullCalendar and I was hoping someone could tell me how I could check whether an event got a description. I tried it with this snippet, but the only

Solution 1:

There are a few things wrong with your code. First, you are initializing your getDesc variable inside the if statement, which, unless I'm wrong, will make it undefined when you try to access it later on in your eventRender function.

You should add var getDesc; above the if condition and remove the semi-colon from after the condition.

Next, you're attempting to set getDesc only when the description is empty. If you want to only set getDesc if there is a value in event.description, then I think you may have wanted to do something like this:

var getDesc = ""; // Change this to your own default valueif (event.description) { getDesc = event.description }
...

Otherwise, if you only want to set it when it's empty, then you could do something like this:

var getDesc = ""; // Change this to your own default valueif (event.description === "") { getDesc = event.description }
...

Let me know if that doesn't answer your question.

Post a Comment for "How To Check For Empty Event.description (google Calendar Feed)?"