Place class “on_off” and then set your data toggle class. This will handle on and off commands for a specific non family class or ID. This will also handle toggling a child of the clicked element. It will also work for a sibling of the clicked element that shares the same parent. It’s all around very useful
$( ".on_off" ).click(function() { //2AM ON AND OFF var what = $(this).attr("data-what"); var what_child = $(this).attr("data-what-child"); var what_parents_child = $(this).attr("data-what-parents-child"); if ( what != null ) { $(what).toggle(); } if ( what_child != null ) { $(what_child, this).toggle(); } if ( what_parents_child != null ) { $(this).parent().children(what_parents_child).toggle(); } }); //2AM ON AND OFF