How to select parent div of a form in JQuery?
<p>here is what i got</p>

<pre><code>&lt;div id="right"&gt;
    &lt;from id="test"&gt;
        &lt;input type="submit"&gt;
    &lt;/form&gt;
    &lt;/div&gt;
</code></pre>

<p>and a lil jquery</p>

<pre><code>    $(document).ready(function(){


        $('form').submit(function()
                         {
                             $(this).parent().html('&lt;h1&gt;1&lt;/h1&gt;');
                         });
    });
</code></pre>

<p>you can play with <a href="http://jsfiddle.net/W9S4F/" rel="nofollow">that here</a>,</p>

<p>and by clicking on submit button it should put <code>&lt;h1&gt;1&lt;/h1&gt;</code> in <code>div#right</code> but it don't ! </p>

<p>Cause <code>this</code> is a form in this case but it works with button label or any thing else and I think that is because form is not a DOM node.</p>

<p>So how can I select the parent of a form, or in other words how can i select the <code>Div</code> that contents the <code>form</code> ?</p>

<p>Update: as it was a part of an ajax call i wanted to break it down and find the problem 
but i had made a typo which cost me an hour or so, but the problem with ajax was that you <code>$(this)</code> inside <code>success:</code> is not the form any more so i did like this</p>

<pre><code>    `$('form').submit(function(){
        form = $(this);//  I set the form to a varible !!

                 $.ajax({



   type: "POST", url: "ajax.php", data: $(this).serialize(),

                success: function(data){
                    $(form).parent().html(data); // I used the varible i set to form before!
                               }});`
</code></pre>

<p>anyways, how can i mark this question as solved ?!</p>
