I'm currently working on a script that will add a left and right border to a button in a row of 3 buttons when that specific button is clicked. The goal is for the borders to remain while the button is active, and disappear once another button is clicked. Here's the code I have so far:
$("#popular").click(function(){
clearBorders();
// Add borders here (this part works)
});
$("#suggestions").click(function(){
clearBorders();
// Add borders here (this part works)
});
$("recent").click(function(){
clearBorders();
// Add borders here (this part works)
});
function clearBorders(){
$('popular').css("border", "solid");
$('suggestions').css("border", "none");
$('recent').css("border", "none");
}
});
Although I can successfully apply the borders to the buttons, I am encountering an issue with the clearBorders function not working as intended. Despite confirming that the function is indeed being called (by inserting an alert at the beginning), it seems to be ineffective. What could be causing this problem?