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

178
Views
Lunr.js mostrando resultados en una nueva página

Tengo un pequeño sitio estático con una búsqueda de palabras básica impulsada por Lunr.js. Tengo un campo de búsqueda que vive en el encabezado de cada página HTML. Estoy usando un json falso porque no necesito a Jekyll

 const fakeJSON = [ { title: "Test", content: "Chocolate bar cupcake chocolate bar cake oat cake sweet roll chocolate cake chupa chups danish. Chocolate cake marshmallow cake cheesecake powder. Candy canes chocolate chupa chups liquorice donut chocolate cake apple pie cupcake soufflé. Halvah gingerbread powder cupcake apple pie chocolate cake. Halvah wafer liquorice sweet roll jelly tart soufflé croissant. Ice cream macaroon lemon drops liquorice ice cream pastry. ", href: "test.html" }

Buscar HTML

 <div class="search-flex"> <form id="search-form" name="searchForm" role="form" onsubmit="return false"> <div class="search-wrapper"> <div class="search-container"> <i class="fa fa-search"></i> <input autocomplete="off" placeholder="" id="search" class="search-input" aria-label="Search site" type="text" name="q"> </div> <div class="search-error hide-element"><span class="search-error-message"></span></div> </div> </form> <button id="clear-search-results-sidebar" class="button clear-search-results hide-element">Clear Search Results</button> </div>

Aquí está la salida de search.js

 function renderSearchResults(query, results) { clearSearchResults(); updateSearchResults(query, results); showSearchResults(); scrollToTop(); } function showSearchResults() { document.querySelector(".search-results").classList.remove("hide-element"); document.getElementById("site-search").classList.add("expanded"); document .getElementById("clear-search-results-sidebar") .classList.remove("hide-element"); }

Me encantaría que el resultado redirigiese a search.html y arrojara resultados.

 <div class="search-results"></div>
about 4 years ago · Juan Pablo Isaza
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!