Remove a dynamic element with jQuery
<p>I am trying to remove a dynamically created element using jQuery.</p>

<p>Here is my example: <a href="http://jsfiddle.net/4uxbu/" rel="nofollow">http://jsfiddle.net/4uxbu/</a></p>

<p>When you click submit it highlights the required fields and displays the text <code>This field is required.</code> after the input. When the user clicks on the input the red box goes away, I want the text below the input to go away as well.</p>

<p>The message is set using the following code:</p>

<pre><code>$('#' + required[i]).after('&lt;p style="font-weight:bold;" id="' + required[i] + '_error"&gt;' + emptyerror + '&lt;/p&gt;');
</code></pre>

<p>and I've tried to remove it with:</p>

<pre><code>$('p#' + required[i] + '_error').remove();
</code></pre>

<p>But I can't get it to work properly.</p>

<p><code>Required</code> is as below</p>

<pre><code>required = ["vidHeight", "title", "vidWidth", "vidLen", "thumb", "file"];
</code></pre>

<p>Please see the fiddle for the full code.</p>

<p>Thanks</p>
