Answers.Body: <p>As the children inherit the settings between the {% nav %}...{% endnav %} so to show an active state on a navigation use...</p>
  
  <pre><code>&lt;ul&gt;
      {% nav entry in craft.entries.section('entry') %}                               
          &lt;li class="
              {% if craft.request.getSegment(1) == entry.slug or 
                    craft.request.getSegment(2) == entry.slug %}
                  selected
              {% endif %}
              {% if craft.entries.section('entry').descendantOf(entry).find() | length &gt; 0 %}
                  has-children
              {% endif %}
          "&gt;
              {{ entry.getLink() }}
              {% ifchildren %}
                  &lt;ul&gt;
                      {% children %}
                  &lt;/ul&gt;
              {% endifchildren %}
          &lt;/li&gt;
      {% endnav %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>Or use entry.level to target the different levels if you need to.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-21T13:56:27.703Z
Answers.LastActivityDate: 2015-11-23T06:45:56.420Z
Answers.LastEditDate: 2015-11-23T06:45:56.420Z
Answers.UserDisplayName: Eli Peters
Answers.Body: <p>I think you need to set a conditional for the entry level for the parent, which is <code>1</code>.</p>
  
  <pre><code>{% set entries = craft.entries.section('pages') %}
  
  &lt;ul id="nav"&gt;
      {% nav entry in entries %}
          &lt;li{% if entry.level == 1 %} class="whatever"{% endif %}&gt;
              &lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;
              {% ifchildren %}
                  &lt;ul&gt;
                      {% children %}
                  &lt;/ul&gt;
              {% endifchildren %}
          &lt;/li&gt;
      {% endnav %}
  &lt;/ul&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-10T20:46:03.197Z
Answers.Text: Thanks Chris. I ended up outputting it with this, a lot of conditionals (because there was more to be changed than i showed for simplicities sake) but it seems to do the trick so it'll work.
Answers.UserDisplayName: Christopher Healey
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-10T20:21:30.643Z
Answers.LastActivityDate: 2015-02-10T20:21:30.643Z
Answers.UserDisplayName: Christopher Kennedy-Nuñez
Body: <p>I need to output different HTML for children of navigation. When i use</p>
  
  <pre><code>{% set entries = craft.entries.section('pages') %}
  
  &lt;ul id="nav"&gt;
      {% nav entry in entries %}
          &lt;li class="whatever"&gt;
              &lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;
              {% ifchildren %}
                  &lt;ul&gt;
                      {% children %}
                  &lt;/ul&gt;
              {% endifchildren %}
          &lt;/li&gt;
      {% endnav %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>It outputs my children having class="whatever" as well. I don't want that, i need something else for the children.</p>
  
  <p>I saw the post here: <a href="https://craftcms.stackexchange.com/questions/1733/custom-or-complex-nav-tag">Custom or complex nav tag</a> about using LEVEL however i don't quite understand how i would write the code for that. Could anybody help? Thanks!</p>
  
Tags: <navigation><children>
Title: Complex Navigation
ThreadText: # Complex Navigation
  
  (Asked by: username_0 on 2015-02-10)
  
  I need to output different HTML for children of navigation. When i use
  
  ```
  {% set entries = craft.entries.section('pages') %}
  
  <ul id="nav">
      {% nav entry in entries %}
          <li class="whatever">
              <a href="{{ entry.url }}">{{ entry.title }}</a>
              {% ifchildren %}
                  <ul>
                      {% children %}
                  </ul>
              {% endifchildren %}
          </li>
      {% endnav %}
  </ul>
  
  ```
  
  It outputs my children having class="whatever" as well. I don't want that, i need something else for the children.
  
  I saw the post here: [Custom or complex nav tag](https://craftcms.stackexchange.com/questions/1733/custom-or-complex-nav-tag) about using LEVEL however i don't quite understand how i would write the code for that. Could anybody help? Thanks!
  
  **Tags:** navigation, children
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-02-10. Score: 5 | Accepted answer
  
  I think you need to set a conditional for the entry level for the parent, which is `1`.
  
  ```
  {% set entries = craft.entries.section('pages') %}
  
  <ul id="nav">
      {% nav entry in entries %}
          <li{% if entry.level == 1 %} class="whatever"{% endif %}>
              <a href="{{ entry.url }}">{{ entry.title }}</a>
              {% ifchildren %}
                  <ul>
                      {% children %}
                  </ul>
              {% endifchildren %}
          </li>
      {% endnav %}
  </ul>
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks Chris. I ended up outputting it with this, a lot of conditionals (because there was more to be changed than i showed for simplicities sake) but it seems to do the trick so it'll work.  
  
  ---
  
  ### Answer by username_1 on 2015-11-21. Score: 1
  
  As the children inherit the settings between the {% nav %}...{% endnav %} so to show an active state on a navigation use...
  
  ```
  <ul>
      {% nav entry in craft.entries.section('entry') %}                               
          <li class="
              {% if craft.request.getSegment(1) == entry.slug or 
                    craft.request.getSegment(2) == entry.slug %}
                  selected
              {% endif %}
              {% if craft.entries.section('entry').descendantOf(entry).find() | length > 0 %}
                  has-children
              {% endif %}
          ">
              {{ entry.getLink() }}
              {% ifchildren %}
                  <ul>
                      {% children %}
                  </ul>
              {% endifchildren %}
          </li>
      {% endnav %}
  </ul>
  
  ```
  
  Or use entry.level to target the different levels if you need to.
  
  
  ---
  
  