jimfog Posted November 27, 2014 Share Posted November 27, 2014 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 More sharing options...
justsomeguy Posted December 1, 2014 Share Posted December 1, 2014 You can't put a control structure inside an assignment statement, so you need to split the assignment into several parts. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now