$('.parent').each(function(i, parent) { $('input.switch', parent).change(function() { console.log( parent ); $(parent).nextUntil('.parent').filter('.child').toggle(this.checked) }).change() });