I'm trying to change the font class name after clicking the link with Javascript and jQuery.
The button example:
<a class='pe-1' onclick='change(this, 24)'><i class='bx bx-bookmark'></i></a>
If I try this way below will change the class from the link instead of the class from the font...
Function example 1:
function change(button, id) {
var changeButton = $(button);
changeButton.removeClass("bx-bookmark").addClass("bxs-bookmark");
}
Unfortunately doing the basic way (like my example below) doesn't really work for me since is going to change the value from all posts instead of just that one post.
Function example 2:
function change(button, id) {
var changeButton = $(button);
$(".bx").removeClass("bx-bookmark").addClass("bxs-bookmark");
}
What I'm missing?