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

134
Visualizações
Using JS Variables in scripts

I'm writing a function in JS that will iterate through a python list and see if any of the numbers in that list match the parameter that is the input for the function. Here's the code:

function popup(elementId)
        {
            for (i = 1; i < {{ len_days }} ; i++) {
                if (elementId === {{ days_list[i] }}) {
                    document.getElementById(elementId.toString()).innerHTML = "working"
                    var popup_element = document.getElementById(elementId);
                    popup_element.classList.toggle("show");
                }
            }
        }

In this case {{days_list}} is the python list. I'm able to select the specific index by using [0] or [1], but I want to be able to use [i] to iterate through all the items in this list. Is there a way for me to use the same i as in the JS for loop, or do I have to make it in python?

about 4 years ago · Juan Pablo Isaza
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