Changing tabs by removing and adding class 'active'

Changing tabs by removing and adding class 'active'

Given the text "webmaster", how do I remove the class from the currently active tab (in this case, organization) and add the active class to "webmaster" for the listitem and its corresponding div below?

Not sure if step 1 and 3 are correct, but I'm not sure how to do step 2.
  1. // Step 1: Remove all active classes because only the href and its corresponding div should have an active class.
  2. $('.nav-tabs li').removeClass('active');

  3. // Step 2: Next step needs to be add the active class to the li that has the href="#webmaster"
  4. ...not sure how to do this

  5. // Step 3: Last step add the class active to the corresponding div of the li we just added
  6. $(('#webmaster')).addClass('active');

  1. <div class="tabbable">
  2. <ul class="nav nav-tabs">
  3. <li class="active"><a ID=t1 href="#organization" data-toggle="tab">Organization</a></li>
  4. <li><a ID=t2 href="#webmaster" data-toggle="tab">Webmaster</a></li>
  5. </ul>
  6. </div>
  7. <div class="tab-content">
  8.     <div class="tab-pane active" id="organization">
  9.       ... some markup
  10.     </div>
  11.     <div class="tab-pane" id="webmaster">
  12.         ... some markup
  13.    </div>
  14.        </div>
  15. </div>