title: How to add class to a jQuery element if a condition is true and remove the same class if the condition is false?
body: <p>Is there a shorter way to do the following?</p>
  
  <pre><code>var select_all_checkbox = $("input.select_all");
  var is_checked = select_all_checkbox.prop("checked");
  
  if (is_checked) {
      select_all_checkbox.parent().addClass("selected");
  } else {
      select_all_checkbox.parent().removeClass("selected");
  }
  </code></pre>