title: Keep the parent li highlighted when a submenu was accesed
body: <p>Hello guys how can I have all  the time the parent "<code>li</code>" highlighted with a background or to give a class with some properties from css on a drop down navigation menu when a sub menu was accessed? something like will indicate in which section of menu it is navigating and that background remain all the time highlighted till will change the menu.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;ul id="menu"&gt;
      &lt;li&gt;&lt;a href="#"&gt;About &lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Programmes&lt;/a&gt;
          &lt;ul class="secondLevel"&gt;
              &lt;li&gt;&lt;a onClick="ajaxCall();" href=""&gt;Undergraduate&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="#"&gt;Postgraduate&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Academics&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Research&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Facilities&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>CSS</p>
  
  <pre><code>#menu, #menu ul {
      margin: 0;
      padding: 0;
      list-style: none;
  } #menu {
      width: 958px;
      /*margin: 60px auto;*/
      border: 1px solid #222;
      background-color: #111;
      background-image: linear-gradient(#444, #111);
  
  box-shadow:
      0 1px 1px #777;
  } #menu:before, #menu:after {
      content: "";
      display: table;
  } #menu:after {
      clear: both;
  } #menu {
      zoom: 1;
  } #menu li {
      float: left;
      border-right: 1px solid #222;
      box-shadow: 1px 0 0 #444;
      position: relative;
  } #menu a {
      float: left;
      padding: 11px 40px;
      color: #999;
      text-transform: uppercase;
      text-decoration: none;
      text-shadow: 0 1px 0 #000;
  } #menu li:hover &gt; a {
      color: #fafafa;
  } * html #menu li a:hover { /* IE6 only */
      color: #fafafa;
  } #menu ul {
      margin: 20px 0 0 0;
      _margin: 0; /*IE6 only*/
      opacity: 0;
      visibility: hidden;
      position: absolute;
      top: 38px;
      left: 0;
      right: -1px;
      z-index: 1000000;
      background: #444;
      background: linear-gradient(#444, #111);
  
  box-shadow:
      0 -1px 0 rgba(255, 255, 255, .3);
  
  transition:all
      .2s
  
  ease-in-out;
  } #menu li:hover &gt; ul {
      opacity: 1;
      visibility: visible;
      margin: 0;
  } #menu ul ul {
      top: 0;
      left: 150px;
      margin: 0 0 0 20px;
      _margin: 0; /*IE6 only*/
      box-shadow: -1px 0 0 rgba(255, 255, 255, .3);
  } #menu ul li {
      float: none;
      display: block;
      border: 0;
      _line-height: 0; /*IE6 only*/
      box-shadow: 0 1px 0 #111, 0 2px 0 #666;
  } #menu ul li:last-child {
      box-shadow: none;
  } #menu ul a {
      padding: 10px;
      _height: 10px; /*IE6 only*/
      display: block;
      white-space: nowrap;
      float: none;
      text-transform: none;
  } #menu ul a:hover {
      background-color: #000000;
  } #menu ul li:first-child &gt; a {
      /*border-radius: 3px 3px 0 0;*/
      padding: 11px 13px;
  } #menu ul li:first-child &gt; a:after {
      content: '';
      position: absolute;
      left: 40px;
      top: -6px;
  } #menu ul ul li:first-child a:after {
      left: -6px;
      top: 50%;
      margin-top: -6px;
      border-left: 0;
  } #menu ul li:first-child a:hover:after {
      border-bottom-color: #000;
  } #menu ul ul li:first-child a:hover:after {
      border-right-color: #000;
      border-bottom-color: transparent;
  } #menu ul li:last-child &gt; a {
      /*border-radius: 0 0 3px 3px*/;
      padding: 11px 20px;
  }
  </code></pre>
  
  <p><a href="http://jsfiddle.net/QztWT/" rel="nofollow"><h1>jsFiddle</h1></a></p>