I have a sequence of repeated results from handlebars templating, which results in:
<div class="checkboxes"><input type="checkbox" class="Btn1"></div>
<div class="checkboxes"><input type="checkbox" class="Btn2"></div>
...more checkboxes
<div class="div1" style="display:none;">...lots of divs...</div>
<div class="div2" style="display:none;">...lots of divs...</div>
<div class="div3" style="display:none;">...lots of divs...</div>
...more divs
<div class="checkboxes"><input type="checkbox" class="Btn1"></div>
<div class="checkboxes"><input type="checkbox" class="Btn2"></div>
...more checkboxes
<div class="div1" style="display:none;">...lots of divs...</div>
<div class="div2" style="display:none;">...lots of divs...</div>
<div class="div3" style="display:none;">...lots of divs...</div>
...more divs
...
Currently have this jQuery, but it opens ALL of the div1s, or div2s, etc..
$(document).on("change",".Btn1",function () {
var $that = $(".div1");
$that.slideToggle();
$("#Btn2").removeClass("active");
$("#Btn3").removeClass("active");
$(".div1").not($that).slideUp();
$(".div2").not($that).slideUp();
$(".div3").not($that).slideUp();
});
Tried a few variations of var $that = $(this).next(".div1");
Any suggestions?