Search code examples
javascripthtmlxmldomxpages

Get all child input elements of fieldsets with classname, input elements being only indirect children of fieldsets


I have an issue regarding some Client JS embedded on an XPage. I want to get the elements shown in the picture with Javascript (DOM), and I am unable to set a classname to the Input directly because the "</xp:checkBoxGroup>" tag (in XPS) generates fieldsets and tables with the classname around the input instead of applying the classname directly to the input.

image showing the html structure and elements I want

Is what I'm trying to do possible?


Solution

  • I looked into CSS selectors again and found a selector that matches my needs:

        function getSelection(){
        var group = document.querySelectorAll("input:checked"); 
        return group;
    }