How to prevent tabs from opening all at once
As you mentioned in the comment, inside-context paragraphs will be just next to clicked anchor’s parent, this code will work: $(“.btn-context”).on(‘click’, function (event) { event.preventDefault(); $(‘.inside-context’).removeClass(‘open’); $(this).parent().next(‘p.inside-context’).addClass(‘open’); });