title: How to trigger css3 rotate effect by clicking?
body: <p>I have two divs. One is applied the rotate effect and another would trigger by clicking.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(function() {
    $("a").click(function() {
      $("#d1").addClass(".spinEffect");
    });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#d1,
  #d2 {
    width: 100px;
    height: 100px;
    background-color: red;
    margin: 50px 50px 50px 50px;
  }
  
  #d2 {
    background-color: green;
    -webkit-animation: spin 10s infinite linear;
  }
  
  .spinEffect {
    -webkit-animation: spin 0.5s 1 linear;
  }
  
  @-webkit-keyframes spin {
    0% {
      -webkit-transform: rotate(0deg);
    }
    100% {
      -webkit-transform: rotate(360deg);
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div id="d1"&gt;
  &lt;/div&gt;
  &lt;div id="d2"&gt;
  &lt;/div&gt;
  &lt;a href=#&gt;click me&lt;/a&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="http://jsfiddle.net/yNT3L/" rel="nofollow noreferrer">Here</a> is the demo page. I know the problem should be in js, could someone tell me how to modify it?</p>
  
  <p>It's working when I remove the <code>.</code></p>
  
  <p>But when I click the link, it only work once. How can I fix that?</p>