jjimenezshaw / Leaflet.Control.Layers.Tree

a Tree Layers Control for Leaflet
https://jjimenezshaw.github.io/Leaflet.Control.Layers.Tree/examples/basic.html
BSD 3-Clause "New" or "Revised" License
146 stars 36 forks source link

Referencing text Labels of children selected in "SelectAllCheckbox" #65

Closed cspence001 closed 1 year ago

cspence001 commented 1 year ago

I'm using this code to reference the labels for children layers upon selection.

var htmlObject = layerControl.getContainer().querySelectorAll('input');
$(htmlObject).on("change", function(e) {
  if ($(this).is(':checked'))
    console.log($(this).siblings('span').text());
});

However, when using the SelectAllCheckbox, only the text label for SelectAllCheckbox is logged. How can I reference the text for all of the child layers upon selection of SelectAllCheckbox of the parent label?