title: Checking which elements have a class and toggling them
body: <p>I am playing around with jsplumb, and I am using it to draw lines between div elements. My div elements serve as destination tags which are positioned on top of a background image. Ultimately, I am trying to form a flight routes map.</p>
  
  <p>For example, when a user presses LONDON LUTON on the map - <code>&lt;div id="luton"&gt;</code> it will toggle class <code>selected</code> on the element and show all destinations from LONDON LUTON, with lines connecting div elements. When the user presses <code>&lt;button class="route-map reset"&gt;</code>, it will reset all the div elements within <code>route-map</code> element, disable jsPlumb connections, and toggle the selected class on the selected element.</p>
  
  <p>How can I find elements which currently have the <code>selected</code> class assigned to them, and toggle them off?</p>
  
  <pre><code>$("#luton").on('click', function() {
      $(this).hide();
      $(this).toggleClass('selected');
      $("#rotterdam").show();
  
  $(".route-map.reset").on('click', function() {
      $('div.route-map').children().show();
      $('div.route-map &gt; div').toggleClass('selected');
      jsPlumb.detachEveryConnection();
  });
  </code></pre>