Using javascript for table headings | XM Community
Skip to main content
Solved

Using javascript for table headings

  • March 9, 2021
  • 2 replies
  • 49 views

Hi,
I am using Javascript to put headings in the top left column of the tables in my survey. I am using the code
var $jq = jQuery.noConflict();
$jq('.Headings .c1').html('write what you want');
I put this in each question's javascript and wrote what I wanted the label to say for each table. When I go to preview the individual questions on editing mode, it appears normal.
When I am taking the survey as a test run though, all the tables on the same page now show the same heading. It appears they all take the heading of the first table. How do I fix this so each table has the correct label I put into its code, and doesn't take the other one on the page?
Thanks.

Best answer by ahmedA

Use this code:

this.questionContainer.querySelector(".Answers").firstElementChild.innerText = "Write What you want"

2 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • Answer
  • March 9, 2021

Use this code:

this.questionContainer.querySelector(".Answers").firstElementChild.innerText = "Write What you want"


Thank you very much.