If syntax in JavaScript | XM Community
Skip to main content
Solved

If syntax in JavaScript

  • September 1, 2020
  • 2 replies
  • 79 views

MikeW
Level 5 ●●●●●
Forum|alt.badge.img+14
  • Level 5 ●●●●●

var col1READONLY = "${e://Field/D2age1eqA2b}";
if (col1READONLY = "1")
{
jQuery("#"+this.questionId+" .c4 input").prop("readonly",true);
}
I'm trying to make a column read only if an embedded variable = "1" (text), however the above appears to be making the column read only all of the time (regardless what the col1READONLY text is.
Am I doing something daft?

Best answer by MikeW

https://www.qualtrics.com/community/discussion/comment/29802#Comment_29802Thank you so much

2 replies

rondev
Level 6 ●●●●●●
Forum|alt.badge.img+22
  • Level 6 ●●●●●●
  • September 1, 2020

Their will two equal to symbol in if condition as shown below:
if (col1READONLY == "1")


MikeW
Level 5 ●●●●●
Forum|alt.badge.img+14
  • Author
  • Level 5 ●●●●●
  • Answer
  • September 1, 2020