Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

176
Visualizações
Qualtrics: Calling javascript variable inside CSS using ${variable } not working

I am going crazy with this so your help will be enormously appreciated.

I have this javascript function:

function fillColor(){

percent1 = (sliderOne.value / sliderMaxValue) * 100;

percent2 = (sliderTwo.value / sliderMaxValue) * 100;

sliderTrack.style.background = linear-gradient(to right, #dadae5 ${percent1}% , #3264fe ${percent1}% ${percent2}%, #dadae5 ${percent2}%);

for some reason the ${percent1} and ${percent2} calls don't work. Everything is fine when I substitute that for actual nubmers though.

What drives me insane is that it works we all when previewing the question, but not when previewing the survey/block! Is ther something about how qualtrics reads the javascript with the ${} language? I have barely any other code in the survey that could be interacting with this, so don't think that's what's gonig on.

Thanks in advance. So much

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I solved it using this:

function fillColor(){

   percent1 = (sliderOne.value / sliderMaxValue) * 100;

   percent2 = (sliderTwo.value / sliderMaxValue) * 100;

  colores = `linear-gradient(to right, #ADD8E6 ` + percent1 + `%, #3264fe ` + percent1 + `%, #3264fe ` + percent2 + `%, #DC143C ` + percent2 + `%)`;

   sliderTrack.style.background = colores;

 }
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda