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

155
Views
Destacando la palabra clave de búsqueda

Creé una base de datos simple y hay una búsqueda en vivo, quiero saber cómo resaltar las palabras clave de búsqueda en la tabla. He estado usando otros medios, pero todavía no funciona. por favor, ayúdame

este es mi codigo:

 $(document).ready(function(){ load_data(); function load_data(search){ $.ajax({ url:"get_data.php", method:"POST", data: { search: search }, success:function(data){ $('#hasil').html(data); } }); } $('#search').keyup(function(){ var search = $("#search").val(); load_data(search); }); function highlight_word(hasil) { var text = document.getElementById("search").value; if(text) { var pattern=new RegExp("("+text+")", "gi"); var new_text=hasil.replace(pattern, "<span class='highlight'>"+text+"</span>"); document.getElementById("hasil").innerHTML=new_text; } }

html:

 <input type="text" class="form-control" id="search" name="search" > <div id="hasil"></div>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Nunca has llamado a la función highlight_word() en alguna parte. puede reemplazar su función de éxito a través de:

 success:function(data){ $('#hasil').html(data); highlight_word(data); }
about 4 years ago · Juan Pablo Isaza Report

0

Siga este artículo. Podrías de esta manera

[https://stackoverflow.com/questions/8644428/how-to-highlight-text-using-javascript][1]

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!