Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

178
Vistas
How to make JS exclude included code from search result?

I currently have a search bar which searches after text in a table. I have added a tooltip in the table which causes me some issues. The code for it looks like this:

<tr>
       <td>Spain</td>
    <td>Portugal</td>
    <td>Turkey</td>
 <td>Greece <span data-text="This is just a placeholder..." 
  class="tooltip"><i style="font-size: 20px; color: #556B2F" class="fa fa-info-circle" id="info-i"></i></span></td>
  </tr>

I have a script that searches for elements in the fields. The problem is that since I have the tooltip within a it also displays that line whenever I add text in the search bar that matches the code for the tooltip. Not only does it display a result at Greece, it also displays when I write "Span" since I have a within.

My JS:

   function performSearch() {

  var filter = searchBox.value.toUpperCase();

  for (var rowI = 0; rowI < trs.length; rowI++) {

    var tds = trs[rowI].getElementsByTagName("td");
      

    trs[rowI].style.display = "none";

    for (var cellI = 0; cellI < tds.length; cellI++) {

      if (tds[cellI].innerHTML.toUpperCase().indexOf(filter) > -1)
        {

            myTable.style.display = "table";
        trs[rowI].style.display = "";
       
        continue;
              
      }
        
        
    }
  }
   
  if (searchBox.value === ''){
    table.style.display='none';
  }
  else {
    table.style.display='table';
  }
             
} 

Is there a way for JS to not display other than the pure text in the resuls and not everything including code?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda