Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

John Ellis's Profile

GitHub User: iamjohnellis

Site: http://www.seriouslyawesome.com

Comments by John Ellis

Avatar

Yes, you could do something like this:

html
<ul class="items">
  <li>Root Item 1</li>
  <li>Root Item 2</li>
  <li>
    Root Item 3 With Children
    <ul style="display:none;">
      <li>Child Item 1</li>
      <li>Child Item 2</li>
    </ul>
  </li>
</ul>

And then open the submenu with, let's say jQuery:

javascript
$(function(){
  $("ul.items li").click(function(){
    $(this).children('ul').toggle();
  });
});