I’m trying to change the CSS of an image that is choosen when the user inputs a name. Currently I have this and it works:
$('.' + userInput).css("box-shadow", "0 0 40px #FFE9D5");
However, when the user inputs another name the CSS stays on the first image selected and also moves to the next image. I’m trying to get it to only stay on the selected input. I thought the code below would work, but it does not. Any suggestions?
$(".myBtn").on("click", function() {
document.getElementById('planets');
if('.' + userInput === planets[i].name) {
$('img').css("box-shadow", "0 0 40px #FFE9D5");
} else {
$(this).remove("box-shadow");
}
});