Skip to content

Instantly share code, notes, and snippets.

@artemsites
Last active July 1, 2019 14:56
Show Gist options
  • Save artemsites/1f1e602f3802b603c8197c2d51c78611 to your computer and use it in GitHub Desktop.
Save artemsites/1f1e602f3802b603c8197c2d51c78611 to your computer and use it in GitHub Desktop.
Кнопка показа и скрытия контента Посмотреть - Скрыть
<div class="question__main">
<div class="question__icon"></div>
<div class="question__content">
<div class="question__title">
ВОПРОС:<br>
Можно ли выписать такого человека без его согласия?
</div>
<div class="question__answer">
Ответ<br>
Можно выписать бывшего жильца без его согласия в судебном порядке.
</div>
<div class="question__answer-full">
В зависимости от причин и обстоятельств переезда родственника, могут применяться различные правовые нормы для урегулирования данной ситуации:
</div>
<button class="question__button" value="1">Посмотреть подробный ответ</button>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('.question__button').click(function(){
$(this).parent().children('div.question__answer-full').toggle('normal');
$(this).text() == 'Посмотреть подробный ответ' ?
$(this).text( "Скрыть" ) :
$(this).text( "Посмотреть подробный ответ" );
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment