title: jQuery: preventDefault on parent link only
body: <p>SOLUTION:</p>
  
  <p>Found a solution.</p>
  
  <p>Used parentNode:</p>
  
  <pre><code>$('.skaftetopmenu-li &gt; a').click(function(e) {
     e.preventDefault();
     var subid = $(this.parentNode).attr('id');
     if (subid !="forsidemenu"){
        var str = $('#submenu-content-'+subid).html();
        if ($.trim(str) == ""){
           $('.submenu-content', this.parentNode).load('http://' + skafte.base_url + '/inc/top-menu-subs/'+subid+'_submenu.html');
        }
     }
  });
  </code></pre>
  
  <hr>
  
  <p>I have a menu like this:</p>
  
  <pre><code>&lt;ul&gt;
    &lt;li class="parent"&gt;
      &lt;a href="url"&gt;Link title parent&lt;/a&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;a href="url"&gt;Link title child&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I have tried the following in jQuery:</p>
  
  <pre><code>$('.parent').click(function(e) {
    e.preventDefault();
  });
  </code></pre>
  
  <p>However this disables all the  elements in the whole menu structure. I want to only disable the parent links. The ones in "ul li", and not the links in "ul ul li", but I can't figure out how and I have searched and searched. So please help me out!</p>
  
  <hr>
  
  <p>EDIT: Thank you for the answers. I thought I would simplify my code in the question but that actually didn't benifit me. So heres the actual code I'm using:</p>
  
  <pre><code>$('.skaftetopmenu-li').click(function(e) {
  
     var subid = $(this).attr('id');
  
     if (subid !="forsidemenu"){
  
        var str = $('#submenu-content-'+subid).html();
  
        if ($.trim(str) == ""){
  
           $('.submenu-content', this).load('http://' + skafte.base_url + '/inc/top-menu-subs/'+subid+'_submenu.html');
        }
     }
  });
  </code></pre>
  
  <p>And the HTML:</p>
  
  <pre><code>&lt;li class="skaftetopmenu-li" id="priser"&gt;
     &lt;a href="http://&lt;?php echo DOMAIN?&gt;/priser.php"&gt;Priser &amp;amp; Sortiment&lt;/a&gt;
     &lt;div class="submenu-content" id="submenu-content-priser"&gt;&lt;/div&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>If I try to do as you suggest and set it to:</p>
  
  <pre><code>$('.skaftetopmenu-li &gt; a').click(function(e) {
     e.preventDefault();
  </code></pre>
  
  <p>It doesn't work..</p>