Answer the question
In order to leave comments, you need to log in
How to make several buttons on the site, when clicked, certain text will be added to a certain div and hide the previous text?
There is such an element on the site, I want to make it so that when you click on small circles, text appears in the center of the large one, each has its own text, while the previous text disappears. I know that this can be done with jquery, but I have no idea how to do it.
Answer the question
In order to leave comments, you need to log in
Let's add a data attribute to
each circle :
And then some jQuery:
$(document).on("click", selector, function(){
$(output).text(this.dataset.word);
//Или $(this).attr("data-word");
});
I know that this can be done with jquery, but I have no idea how to do it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question