I am creating an A/B test variant using VWO. The website has a list with checkboxes laid out like so;
<ol>
<li>
<label>
<input class="checkBox" type="checkbox">
<p class="checkBoxAnc">Text to grab</p>
</label>
</li>
</ol>
There is an apply button, when this is clicked I want it to cycle through all of the inputs. If checked is true then I need to grab the text from the class "checkBoxAnc" (p element) and concatenate it to a variable.
I have tried the following:
var self= $(this);
//This is referring to the input that the user has clicked, so class '.checkBox'
self.next() // This doesn't work as element's do not match
self.nextUntil('.checkBoxAnc') // Same issue as .next()
var checkBoxSibling = self.parent().find('.checkBoxAnc').text();
// This returns an empty string
When trying to find the parent type this is being returned as 'undefined' rather than 'label'
Are there any other techniques to access '.checkBoxAnc'?