Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

238
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!