Toggle jQuery-UI widgets

Posted by cf_PhillipSenn on Stack Overflow See other posts from Stack Overflow or by cf_PhillipSenn
Published on 2010-04-28T14:56:03Z Indexed on 2010/04/28 15:03 UTC
Read the original article Hit count: 220

Filed under:

I have:

<div class="ui-widget">
   <div class="ui-widget-header">
      <span class="ui-icon ui-icon-circle-triangle-n">My Menu</span>
   </div>
   <ul class="ui-widget-content">
      <li>Menu Item 1</li>
      <li>Menu Item 2</li>
      <li>Menu Item 3</li>
   </ul>
</div>

My jQuery is:

$('.ui-widget-header').click(function() {
   $('.ui-widget-header+ul').toggle('slow');        
});

Q: How do I toggle classes between ui-icon-circle-triangle-n and ui-icon-circle-triangle-s as the user clicks on .ui-widget-header?

© Stack Overflow or respective owner

Related posts about jquery-ui