Jump to content

printing in the browser using if statement


jimfog

Recommended Posts

I have the following code:

	'<div class="fc-time"' +' data-start="' + htmlEscape(startTimeText) + '"' +						' data-full="' + htmlEscape(fullTimeText) + '"' +						'>' +'<span>' + htmlEscape(timeText) + '</span>' +						'</div>' :'') +                                                               (event.title ?'<div class="fc-title">'+ htmlEscape(event.title) + '</div>' :						''						) +                                                                                 				'</div>' +

Above you see ternary operators used along with the string concatenation symbol to print to the browser.

My issue is that I want to use if statements instead to print to the browser....for example in the code relevant to event title.

</div>' :'') +//if statement here +   

The problem is that the if statement along with the string concatenation operator seem not to work...it is syntax problem.

How am I going to tackle it?

 

One thought is to write the if statement outside any div etc strings and then move whatever variable needed inside the div block.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...