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

239
Visualizações
Cant read value from function parameter to function getElementById()

I have a problem with HTML and JS... I made a function with parameter, parameter should be ID of HTML element. But my function take that value, and function getElementById can't read that value. I make a test with console log, and I will show you that on image.

JS Function

function HideShowElementDeleteFolder(id){
  var x = document.getElementById(id);
  console.log(x);
  console.log(id);
  if (x.style.display === "none") {
    x.style.display = "block";
  } else {
   x.style.display = "none";
  }
}

Calling JS function in HTML

<a class="text-danger" onclick="HideShowElementDeleteFolder('<?php echo $value; ?>')">
   <i class="fas fa-times"></i>
</a>

HTML Element what I want to show on click

<div id="<?php $value; ?>" class="widget-header clearfix" style="display:none;">
    <form action="" method="post">
        <div>
            <a href="dashboard-files.php?folder=<?php echo $value; ?>">
               <button type="submit" class="btn btn-primary mt-2 mb-2">Obrisi folder</button> 
            </a>
        </div>
    </form>
</div>

enter image description here

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