Search code examples
javascriptsurveyjs

how to label in between surveyjs radio group


enter image description here

But using surveyjs i cannot find any solution to add between the radio button.

some working code to edit link2

[1]: https://i.sstatic.net/CWQVL.png
  [2]: https://jsfiddle.net/myselfdesai/xeyqca75/

Solution

  • According to my understanding the you are trying to add the sub title between your single group of radio button.

    For this you have to manually add the custom java-script code manipulate DOM element. The functionality provided by surveyjs is given below.

    survey
        .onAfterRenderQuestion
        .add(function(){
         <add your custom javascript code>
         });
    

    I have added the code with considering basic DOM element position.

    survey
        .onAfterRenderQuestion
        .add(function(){
            $( 
            //first I have collected all the div element position of using question form id 
            let divs = document.querySelectorAll("#question_id form div");
            $('</br></br><span><h4> Medical/Dental</h4><span>').insertBefore(divs[0]);
            $('</br></br><span><h4> Nursing </h4></span>').insertBefore(divs[9]);
    
        });
    

    This can solve your problem remember to add proper div object index to add span for particular location.