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

86
Vistas
Search bar using Window. Find in js and html

Hello I am trying to make a search bar to search anything which is available on a html page. I used window.find method.it highlights the string if its available in the html page. It returns a boolean value true or false. It gives false if the searched string is not available. But main problem is that it also returns false if all the searched strings are highlighted.Then how can I message the user that Nothing found OR searched text is already highlighted. I also want to Search again if button clicked again also when all the searched text is highlighted .

I AM USING THIS CODE BUT ITS NOT COMPLETING MY ALL WISHES THAT I WANT.

JS

function  SEARCH(){
 var Search=document.getElementById("Search").value;
 var result=window.find(Search);
 if (result == false) {
  alert("Nothing found or already highlighted "
); }
} 

HTML

<input class="FLDS" type="text" id="Search" placeholder="Search" />
  <button onclick="SEARCH()" id="SEARCHIT">SEARCH</button>

<p>    A paragraph is a self-contained unit of discourse in writing dealing with a particular point or idea. A paragraph consists of one or more sentences. Though not required by the syntax of any language, paragraphs are usually an expected part of formal writing, used to organize longer prose.   </p>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I would recommend maybe trying to implement some PHP Ajax into your code and look at this link https://www.w3schools.com/php/php_ajax_livesearch.asp. If you're confused about how to do it reach out to me zackhitane@gmail.com and I can help you through it.

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