The problem is that with the "text 1" field open, I click on "button 2" and this text is not hidden (I want to do it, after clicking it climbs what belongs to this button, I don’t understand how to do the cleaning)
script
$(document).ready(function(){ $('.spoiler-body').hide(); $('.spoiler-title').click(function(){ $(this).next().toggle(); }); }); css
.spoiler-title { cursor: pointer; } .spoiler-body { display: none; } html
<div class="spoiler-title">Кнопка 1</div> <div class="spoiler-body">Текст 1</div> <div class="spoiler-title">Кнопка 2</div> <div class="spoiler-body">Текст 2</div>