Swapping DIV class, not working

Swapping DIV class, not working

I am trying to build a simple FAQ type of list with a twirl down arrow on each main item. I got the data for each item to hide/unhide but am having trouble getting the arrow to twirl. Any ideas?


My HTML
  1. <div class="comparison-content">
  2.      <div class="item">
  3.           <div class="title">
  4.                <div class="arrow-right"></div>
  5.                <a class="link">First Item on the list.</a>
  6.           </div>
  7.           <ul class="data">
  8.                 <li class="subitem">First information</li>
  9.                 <li class="subitem">More information</li>
  10.           </ul>
  11.      </div>
  12.      <div class="item">
  13.           <div class="title">
  14.                <div class="arrow-right"></div>
  15.                <a class="link">Second Item on the list.</a>
  16.           </div>
  17.           <ul class="data">
  18.                <li class="subitem">Second information</li>
  19.                <li class="subitem">More information</li>
  20.           </ul>
  21.      </div>
  22. ----repeat "item" divs ----
  23. </div>


My jQ initialization
  1. $(document).ready(function() {
  2.   $('div .comparison-content .item > .data').hide();
  3.   $('div .comparison-content .item').click(function() {
  4. $(this).children('.data').toggle();
  5. $(this).children('.title .arrow-right').toggle(
  6. function() {
  7. $(this).addClass('arrow-down').removeClass('arrow-right');
  8. },
  9. function() {
  10. $(this).addClass('arrow-right').removeClass('arrow-down');
  11. });
  12.   });
  13. });


So it first goes through and hides all the "data" DIVs.  Then when you click on the "item" DIV it will show it.  That works.

Second when clicking on the "item" DIV it should step down inside the "title" DIV and replace the DIV class for "arrow-right" with "arrow-down". If clicked again it should reverse it.

That doesn't work.