Answer the question
In order to leave comments, you need to log in
How to specify that the div that comes immediately after the button that was clicked is unfolded, and not all divs with this class?
Hello.
There is a code.
$(".button-read_more").click(function(e){
e.preventDefault();
$("div.b-room-full-info").slideToggle("slow");
});
Answer the question
In order to leave comments, you need to log in
$(".button-read_more").click(function(e){
e.preventDefault();
$(this).next().slideToggle("slow");
});
Instead $("div.b-room-full-info")
, use $(this)
- refers directly to the element that called the function. Or use id instead of class. Essentially the same, but is unique, unlike a class. Then the code will be like this:$("#id_of_your_div")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question