I've previously used the following code in a survey to insert $ and .00 around all text fields in a 3D Matrix.
Qualtrics.SurveyEngine.addOnload(function()
{
var inputs = $(this.getQuestionContainer()).select('input[type="text"]');
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
$(input).insert({before: '$ '});
$(input).insert({after: ' .00'});
}
});
My problem now is that I have a 3D Matrix question with two columns, but I would only like the symbols to be applied to the second column. What do I need to change in my Javascript to make it happen? (Thank you in advanced if you can help.)
Solved
Javascript for adding symbols before and after fields in just one column of a 3D Matrix
Best answer by SurajK
https://www.qualtrics.com/community/discussion/comment/29369#Comment_29369Ok, so in this case we can add 2 extra lines for the total box and using index we can add the symbols like below, as per your screenshot, the total box has index 6.
Qualtrics.SurveyEngine.addOnload(function()
{
var inputs = $(this.getQuestionContainer()).select('input[type="text"]')
for (var i = 1; i < inputs.length; i+=2) {
var input = inputs[i];
$(input).insert({before: '$ '});
$(input).insert({after: ' .00'});
}
jQuery('input[type="text"]').eq(6).before('$')
jQuery('input[type="text"]').eq(6).after(' .00')
});
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.


Appreciate your kind help in advance! :)