title: Add class on click?
body: <p>I want to add a class to div.color everytime I click on h1. </p>
  
  <p>The issue is that I want a different class to be added to div.color when I click a different h1. </p>
  
  <p>When I click <code>&lt;h1 data-class="blue"&gt;</code></p>
  
  <p><code>&lt;div class="color"&gt;</code> becomes <code>&lt;div class="color blue"&gt;</code></p>
  
  <p>How do I do that? I'm new to jquery so this is quite difficult for me...</p>
  
  <pre><code>&lt;h1 data-class="blue"&gt;Blue&lt;/h1&gt;
  &lt;h1 data-class="green"&gt;Green&lt;/h1&gt;
  
  &lt;div class="color"&gt;I'm changing colour here.&lt;/div&gt;
  
  &lt;script&gt;
  $('h1.color').on('click', function() {
      $(this).css({"background":"attr('data-class')"});
  });
   &lt;/script&gt;
  </code></pre>