jQuery Conditional Statement (Ternary) for text()
<p>I'm trying to set the text value of an element (promo-footer) to the contents of a variable (footerVar) if it is not an empty string ''.</p>

<pre><code>$('.promo-footer').text(footerVar == '' ? 'no' : footerVar);
</code></pre>

<p>That works, and only displays the footer text if it exists, and the variable is an empty string '' then it displays "no"...</p>

<p>My question is - why does this work?  I thought the first thing after the question mark happens if the equation evaluates to <code>true</code>?</p>

<pre><code>x = (1 &lt; 2) ? true : false;
</code></pre>

<p>Here it is in action: <a href="https://jsfiddle.net/xfzgaLq6/" rel="nofollow">https://jsfiddle.net/xfzgaLq6/</a></p>