Add mandatory red asterisk to the Label for checkbox

vai
Kilo Contributor

I have a group of individual checkbox variables, i want to add a red asterisk to the Label of the checkbox list..

 

I created a UI policy with conditions checking if the checkbox is not checked... In the advanced view i added the below script..

 

  var mandatoryLabel = 'What Accessories are needed?';

    //Get all of the LABEL tag elements and check for a matching label

    $$('label').each(function(labels) {

          if(labels.innerHTML.indexOf(mandatoryLabel) > -1){

                //Set the 'mandatory' class name for the label element

  labels.previousSibling.className = 'mandatory required-marker label_description';

          }

    });

 

I see error as Labels is undefined.