jQuery - Uncaught TypeError: Object #<HTMLElement> has no method 'parent'
<p>Something is wrong with my code. Chrome code spectrator say that there is probmel in line number 21, problem like this: <code>Uncaught TypeError: Object #&lt;HTMLElement&gt; has no method 'parent'</code>. This is jQuery code:</p>

<pre><code>  $('.plus').click(function(){
    if ($(this).text() == "+"){    /* 1 IF       */
        $(this).text("-");

        if (! ($(this).parent().next().is('ul'))){            /* 2 IF */
        var element_id = $(this).parent().attr('id') 
        var id = '#' + element_id
        var url = "/accounts/profile/thingh_update/" + element_id + "/";

        $.getJSON(url, function(data){
        var items = []

        $.each(data, function(index, value) {    if(value.pk)        
        items.push('&lt;li id="' + value.pk + '"&gt;' + value.fields.title + '&amp;nbsp;&amp;nbsp;&lt;span class="plus"&gt;+&lt;/span&gt;&lt;/li&gt;');});

        $('&lt;ul/&gt;', {
        html: items.join('')
        }).insertAfter(id); })
        } else {(this).parent().next().children().show()}    /* 2 ELSE */
      } else {$(this).text('+').parent().next().hide()}    /* 1 ELSE */
  })    
}) 
</code></pre>

<p>My html looks like this:</p>

<pre><code>&lt;ul&gt;
    &lt;li id="3"&gt;&lt;a href="/my/proper/url/"&gt;this is for eat&lt;/a&gt;&amp;nbsp;&amp;nbsp;
    &lt;span class="plus"&gt;+&lt;/span&gt;&lt;/li&gt; &lt;!-- after clickin this I get proper json data, and "+" is cahnged to "-", and the next "&lt;ul&gt;" element appear --&gt;
    &lt;ul&gt;
    &lt;li id="4"&gt;fishes&amp;nbsp;&amp;nbsp;
    &lt;span class="plus"&gt;+&lt;/span&gt;&lt;/li&gt;
    &lt;/ul&gt;
&lt;/ul&gt;
</code></pre>

<p>And when I click on "-" in first "li" element and then again on "+" i get: </p>

<pre><code>Uncaught TypeError: Object #&lt;HTMLElement&gt; has no method 'parent'
</code></pre>

<p>Maybe i missed something obvious, but I am not advanced in jQuery yet. I ask for some tolerance for beginner and any sugegestions of where could I do mistake.
Thanks.</p>
