title: jquery onclick toggle image src
body: <p>I put together this code here:</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>$('img').on({
      'click': function() {
           var src = ($(this).attr('src') === 'memes/2a.png')
               ? 'memes/2b.png'
               : 'memes/2a.png';
           $(this).attr('src', src);
       }
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;a href="#"&gt;&lt;img id="img1" src="memes/2a.png" height="500" width="600"&gt;&lt;/a&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>It should toggle between the two images: 2a.png and 2b.png it nothing happens when i click on it.</p>
  
  <p>Can someone tell me what i'm doing wrong?</p>