Hi,
I have a survey where nearly every question collects monetary data. I would like to display a dollar sign before the text entry field, and ".00" after each field. I am able to use the following Javascript where I have a single column of text fields.
However, I have a couple of questions where there is more than column, and a column in the grid collects numerical but non-monetary data. I also have questions with a single column, with a text entry field on the last line.
In these cases the Javascript displays the dollar sign and cents where I don't want them to appear. Is there any way I can adjust the Javascript so the symbols do not appear in the first column?
Displaying symbols before and after text entry fields in one column only
Best answer by ahmedA
No. You weren't wrong, its just that the constant sum question is structured differently.
I would therefore recommend moving to a matrix style question for consistency (i.e. code reuse).
Here's something that should work for you;
Qualtrics.SurveyEngine.addOnReady(function () {
let all_rows = this.questionContainer.querySelectorAll("li");
for (let i = 0; i < all_rows.length; i++) {
let input_el = all_rows[i].querySelector("[class*='Sum'] input");
input_el.insertAdjacentHTML("beforebegin", "$");
input_el.insertAdjacentHTML("afterend", ".00");
input_el.style.width = "100px";
}
});
Result:
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.






