JQuery Replace Attribute Source Not Working
<p>I have a button named "on" (on.png) and a button named "off" (off.png). They are designed to act as on/off switches, so when clicked, the other should load. Since I don't want to deal with the path (which is the same for both), I am trying to do an attribute replace. The jQuery code below, however, does nothing and I can't find the error. Any help is appreciated.</p>

<pre><code>$('#btnDining').css({'cursor':'pointer'}).on('click', function(e){
   var src = $(this).attr('src');
   $(this).attr('src', function(i, src){
      return (src.indexOf('off.png')!=-1)?src.replace("_off","_on"):src.replace("_on","_off");
   });
}); // end button click
</code></pre>
