title: jQuery : Use an alternative to .toggle() which is deprecated
body: <p>I have some images with class name ".mute_btn" and when i click on them, my images source is changing :</p>
  
  <pre><code>$('.mute_btn').toggle(function () {
          var clicked = false;
          var src = $(this).attr("src");
          src = src.replace(/(.*)\.(png|gif|jpg|jpeg)$/, "$1-over.$2");
          $(this).attr("src", src);
      }, function () {
        var src = $(this).attr("src");
        src = src.replace(/(.*)-over\.(png|gif|jpg|jpeg)$/, "$1.$2");
        $(this).attr("src", src);
      });
  </code></pre>
  
  <p>But i've seen that toggle() is deprecated in jQuery 1.8</p>
  
  <p>So i'm trying to do it like this :</p>
  
  <pre><code>var clicked = false;
  $('.mute_btn').click(function() {
          if (clicked) {
  
              var src = $(this).attr("src");
              src = src.replace(/(.*)-over\.(png|gif|jpg|jpeg)$/, "$1.$2");
              $(this).attr("src", src);
              clicked = false;
          }
          else {
              var src = $(this).attr("src");
              src = src.replace(/(.*)\.(png|gif|jpg|jpeg)$/, "$1-over.$2");
              $(this).attr("src", src);
              clicked = true;
          }});
  </code></pre>
  
  <p>But the result is not perfect. Sometime, the images do not change state.</p>
  
  <p>Do you know what's wrong ?</p>