I wrote some code to toggle the src of an image and also to pause/resume the jQuery cycle2 plugin.
I\'m not sure why it isn\'t working and would appreciate some help
$(document).ready(function(){
$(".bulb").click(function(){
var src = $(this).attr('src');
var newsrc = (src=='images/dim.png') ? 'images/glow.png' : 'images/dim.png';
$(this).attr('src', newsrc );
});
});
Even more reducing lines is possible but avoided confusion. Basically , it gets the current state attribute source and checks and assigns required source.