How to hide the language box based on embedded data? | XM Community
Skip to main content
Please check the following code for me:



if ('${e://Field/Country}'='HKG') {

.LanguageSelectorContainer{

display: none;

};

}
I have replaced "=" with "==", but still doesn't work
Hi @xiangyu



You're in the right direction. But you've mixed JavaScript with CSS. It could be done in like this:



Edit Question JavaScript

```

if ('${e://Field/Country}'=='HKG') {

jQuery('.LanguageSelectorContainer').addClass('LanguageSelectorContainerHK');

}

```



Paste CSS into "Look and Feel" -> "General" -> "Style" -> "Custom CSS"

```

.LanguageSelectorContainerHK {

display: none;

};

```



Just make sure you've added "LanguageSelectorContainer" class name to the question html.



Hope it helps, cheers.

Zhen





!



!
Hi @Zhen ,

Thanks a lot for your help. It works now.

Just to confirm, if I want to hide the language box for the entire survey if country==HKG, then I need to add the JavaScript into each Question of the survey?
No problem xiangyu, great it works for you!



It can be added to each question as inline JS as you've suggested; or extract it out to a separate external JS file and embed it to survey header/footer via "Looks and Feel".



Cheers,

Zhen

Leave a Reply