Answer the question
In order to leave comments, you need to log in
How to open one question on click and close another?
Hello
There is the following code:
https://codepen.io/anon/pen/KQXmew
$('.price .questions .wrap-q .1 .quest').click(function(){
$('.price .questions .wrap-q .1 .ans').toggle();
$('.price .questions .wrap-q .1 .quest .close').toggle();
$('.price .questions .wrap-q .1 .quest .open').toggle();
});
$('.price .questions .wrap-q .2 .quest').click(function(){
$('.price .questions .wrap-q .2 .ans').toggle();
$('.price .questions .wrap-q .2 .quest .close').toggle();
$('.price .questions .wrap-q .2 .quest .open').toggle();
});
$('.price .questions .wrap-q .3 .quest').click(function(){
$('.price .questions .wrap-q .3 .ans').toggle();
$('.price .questions .wrap-q .3 .quest .close').toggle();
$('.price .questions .wrap-q .3 .quest .open').toggle();
});
Answer the question
In order to leave comments, you need to log in
<div class="qcont">
<div class="1">
<div class="quest">Вопрос 1</div>
<div class="answ">Ответ 1</div>
</div>
<div class="2">
<div class="quest">Вопрос 2</div>
<div class="answ">Ответ 2</div>
</div>
<div class="3">
<div class="quest">Вопрос 3</div>
<div class="answ">Ответ 3</div>
</div>
</div>
$('.qcont').children().click(function() {
$('.answ').hide();
$(this).find('.answ').show();
});
$('.etot_class').click(function() {
$('.answ').hide();
$(this).find('.answ').show();
});
The easiest way to get started is with Bootstrap. There is a ready solution .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question