Being new to Jquery and Javascript, I am facing challenges in understanding how to implement the following.
Throughout my site, I use the same button class, and I am attempting to make Jquery apply a "clicked" class only to the button that was clicked, not to all others.
This is the code I currently have...
$(".button-img").click(function() {
var clickedButton = $(this);
if (clickedButton.hasClass('clicked')) {
return false;
}
clickedButton.addClass('clicked');
});
The functionality I am aiming for can be better understood in this fiddle - http://jsfiddle.net/biggee/FQqL8/1/
Despite my efforts, I still feel like I'm missing something crucial. Any assistance or guidance would be greatly appreciated.