Add a $ in front of one set of text boxes in Constant Sum | XM Community
Skip to main content

I want to add a $ sign in front of my Cost column of text boxes, but not Quantity. How do I make that happen?

 

Hey @chriscraven , Try using the below code.

 

Qualtrics.SurveyEngine.addOnload(function() {
    // Get all text input fields within the question container
    var inputs = $(this.getQuestionContainer()).select('input(type="text"]');
    
    // Loop through each text input field, but only on odd indices (1,3,5, ...)
    for (var i = 1; i < inputs.length; i += 2) {
        var input = inputsvi];
        // Insert a dollar sign ('$ ') before each selected text input field
        $(input).insert({ before: '$ ' });
    }
});


@chriscraven,

You can do this without JS.  Add this html to your question text:

.ChoiceRow td.last::before { content: "$"; }

 


Leave a Reply