Only add if it's not present
<p>I only want to add this if it's not already present</p>

<pre><code>$('#main_state').append('&lt;label class="check error" generated="true"&gt;This field is required.&lt;/label&gt;');
</code></pre>

<p>So I have a loop and I only want to add it the first time...any ideas?</p>
