Answer the question
In order to leave comments, you need to log in
How to make sure that when you click on a certain object in a certain block, the site understands this?
I have blocks in which the content is the same, and when clicked, all blocks open (I have hide and show there). I need to open only the block that I click on.
Answer the question
In order to leave comments, you need to log in
Use index():
$(".div").on("click", function(){
var index = $("div").index(this);
// После чего вставь свой код который отвечает за показ и закрытие блока, только к селекторам
// прибавь .eq(index)
$("div").eq(index).hide(); // eq метод выбирает элемент по индексу
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question