Apply conditional statements within string output in JavaScript
<p>I'm using a jQuery plugin named "<a href="http://jparse.kylerush.net/" rel="nofollow">jParse</a>" to parse an XML file like so:</p>

<pre><code>$('#content').jParse({
 ajaxOpts: {url: 'data.xml'},
 elementTag: ['title', 'description'],
 output: '&lt;h2&gt;jpet0&lt;/h2&gt;&lt;p&gt;jpet1&lt;/p&gt;'
});
</code></pre>

<p>As you can see, the "jpet" variables correlate with the elementTag array.</p>

<p>How would I check to see if the jpet var contains data (as some of the tags in the XML are empty) and withhold the HTML tags if it doesn't?</p>

<p>This doesn't work:</p>

<pre><code>$('#content').jParse({
 ajaxOpts: {url: 'data.xml'},
 elementTag: ['title', 'description', 'extra'],
 output: if (jpet0) { '&lt;h2&gt;jpet0&lt;/h2&gt;' } + '&lt;p&gt;jpet1&lt;/p&gt;&lt;p&gt;jpet2&lt;/p&gt;'
});
</code></pre>

<p>But it does give a good idea of what I'm trying to achieve.</p>

<p>Thanks in advance!</p>
