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

218
Views
ΒΏCΓ³mo convertir texto elegante a texto normal en javascript?

Estoy creando una funciΓ³n de bΓΊsqueda en javascript que tiene texto normal y elegante.

El problema es al buscar: Valor de texto elegante: 𝗑𝗲𝗲𝗱 π˜π—Ό π—žπ—»π—Όπ˜„ π—”π—―π—Όπ˜‚π˜

No funciona.

 document.getElementById("search").addEventListener("keyup", function(evt) { [].forEach.call(document.querySelectorAll(".subjects .subject"), function(subject) { if (subject.textContent.indexOf(evt.target.value) === -1) { subject.classList.add("hide"); } else { subject.classList.remove("hide"); } }); }, false);
 <input id="search"></input> <div class="subjects"> <div class="subject">soccer</div> <div class="subject">dancing</div> <div class="subject">π—¬π—Όπ˜‚ 𝗑𝗲𝗲𝗱 π˜π—Ό π—žπ—»π—Όπ˜„ π—”π—―π—Όπ˜‚π˜ </div> </div>

http://jsfiddle.net/goLk7qyf/

about 4 years ago Β· Juan Pablo Isaza
1 answers
Answer question

0

Normalice la cadena con descomposiciΓ³n de compatibilidad antes de buscar

 const subjects = document.querySelectorAll(".subjects .subject"); const normalisationForm = "NFKC"; document .getElementById("search") .addEventListener("input", ({ target: { value } }) => { subjects.forEach(({ classList, textContent }) => { const normalised = textContent.normalize(normalisationForm).toLowerCase(); classList.toggle("hide", !normalised.includes(value.toLowerCase())); }); });
 .hide { text-decoration: line-through; opacity: .6; }
 <input id="search" /> <div class="subjects"> <div class="subject">soccer</div> <div class="subject">dancing</div> <div class="subject">π—¬π—Όπ˜‚ 𝗑𝗲𝗲𝗱 π˜π—Ό π—žπ—»π—Όπ˜„ π—”π—―π—Όπ˜‚π˜ </div> </div>

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!