JQuery add/remove class on click – toggleClass()

jQuery Function

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

<script type="text/javascript">
    $(document).ready(function () {
        $('#menu li').on('click', function () {
            $(this).toggleClass('open');
    });
});
</script>
HTML

<ul id="menu">
  <li> <a href="#">Menu</a>
    <ul>
      <li><a href="#">Item</a> </li>
    </ul>
  </li>
  </li>
</ul>