- 🇧🇪Belgium hansrossel
The html structure has changed a bit, so here is an updated version of the code.
You can also use it in a script.js file in your admin theme.Drupal.behaviors.termReferenceTreeExpand = { attach: function(context, settings) { $('.field-widget-term-reference-tree .form-checkbox', context).once('term-ref-tree').change(function() { var isChecked = $(this).is(':checked'); // Toggle the collapsed state of the term tree $(this).parent().parent().siblings('.term-reference-tree-button').toggleClass('term-reference-tree-collapsed'); // Toggle the show/hide of the child term list $(this).parent().parent().siblings('.term-reference-tree-level').toggle(isChecked); }); } };