How can I change the question text using Java script? | XM Community
Skip to main content
Solved

How can I change the question text using Java script?

  • August 7, 2020
  • 2 replies
  • 712 views

Hello, I have looked everywhere for this but can't seem to find an answer on my own so I need some help as I am new to JS and trying to learn.
What code would I need for changing the question text using Java script?
I know that
jQuery("#"+this.questionId+" .QuestionText").hide()

will hide the question text so logically I'm thinking that to define the value of the question text, the code would start:
jQuery("#"+this.questionId+" .QuestionText")

but what comes next? would it be
jQuery("#"+this.questionId+" .QuestionText").value("Hello everybody")



Much thanks and appreciation in advance

Dan

Best answer by rondev

Use below code for this:
jQuery("#"+this.questionId+" .QuestionText").html("Hello everybody");

2 replies

rondev
Level 6 ●●●●●●
Forum|alt.badge.img+22
  • Level 6 ●●●●●●
  • Answer
  • August 7, 2020

Use below code for this:
jQuery("#"+this.questionId+" .QuestionText").html("Hello everybody");


  • Author
  • August 8, 2020

AHHHH thank you! It works like a dream