So I'm creating a cost calculator in jQuery and PHP. I use the following snippet to toggle a button, so user will see what is checked.
$("[data-button='5']").click(function(){
$("[data-button='5'] .status").attr("src" , "hintalaskurikuvat/greenstatus.png");
$("[data-button='5']").toggleClass("selected");
});
But however, it won't toggle the image, I know that. Is there a simple way to toggle between
hintalaskurikuvat/greenstatus.png and hintalaskurikuvat/redstatus.png as the src for [data-button='5']?