use jquery to remove element from parent
<p>i have a form with multiple div elements like this</p>

<pre><code>&lt;div&gt;
&lt;label for="id"&gt;text&lt;/label&gt;
&lt;input type="text" name="id" id="id" value=""&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;label for="id1"&gt;text&lt;/label&gt;
&lt;input type="text" name="id1" id="id1" value=""&gt;
&lt;/div&gt;
</code></pre>

<p>i use .post to validate some fields before submit
if the input failed validation i add a span element to the parent div</p>

<pre><code>$('#id').parent('div:first').append('&lt;span class="error"&gt;error message&lt;/span&gt;');
&lt;div&gt;
&lt;label for="id"&gt;text&lt;/label&gt;
&lt;input type="text" name="id" id="id" value=""&gt;
    &lt;span class="error"&gt;error message&lt;/span&gt;
&lt;/div&gt;
</code></pre>

<p>else i want to remove the span from the div and i tried </p>

<pre><code>$('#id').parent('div:first').remove('.error');
$('#id').parent('div:first').remove('span');
</code></pre>

<p>but doesn't work
any ideas ?</p>
