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

88
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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