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

82
Views
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 answers
Answer question

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 Report
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!