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

225
Views
Is there a way to hide the elements in the list

So what i am trying to do is to create a reactive javascript search bar but my variables are showing as a list.Is there a way to hide the elements and they show up when i write down the name?

So what i am trying to do is to create a reactive javascript search bar but my variables are showing as a list.Is there a way to hide the elements and they show up when i write down the name?

   box-sizing: border-box;
 }

 #myInput {
   background-position: 10px 12px;
   background-repeat: no-repeat;
   width: 100%;
   font-size: 16px;
   padding: 12px 20px 12px 40px;
   border: 1px solid #ddd;
   margin-bottom: 12px;
 }

 #myUL {
   list-style-type: none;
   padding: 0;
   margin: 0;
 }

 #myUL li a {
   border: 1px solid #ddd;
   margin-top: -1px; /* Prevent double borders */
   background-color: #f6f6f6;
   padding: 12px;
   text-decoration: none;
   font-size: 18px;
   color: black;
   display: block
 }

 #myUL li a:hover:not(.header) {
   background-color: #eee;
 }
</style>
</head>
<body>



<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Database içinde ara..." title="Type in a name">

<ul id="myUL">

 <li><a href="http://127.0.0.1/duzenle.php?cariid=0000000104">Selen Hasan</a></li>

 <li><a href="http://127.0.0.1/duzenle.php?cariid=0000000106">Metin Özkan</a></li>

 <li><a href="http://127.0.0.1/duzenle.php?cariid=0000000128">Metin Tekin</a></li>

 <li><a href="http://127.0.0.1/duzenle.php?cariid=0000000130">Erdal Aşık</a></li>

</ul>


 function myFunction() {
   var input, filter, ul, li, a, i, txtValue;
   input = document.getElementById("myInput");

   filter = input.value.toUpperCase();

   ul = document.getElementById("myUL");
   li = ul.getElementsByTagName("li");

   for (i = 0; i < li.length; i++)
   {
     a = li[i].getElementsByTagName("a")[0];
     txtValue = a.textContent || a.innerText;

     if (txtValue.toUpperCase().indexOf(filter) > -1)
     {
       li[i].style.display = "";
     }
     else
     {
       li[i].style.display = "none";
     }
   }
 }


</body>
</html>
`
 






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!