Skip to main content
Known Participant
October 29, 2018
Question

search box

  • October 29, 2018
  • 4 replies
  • 1036 views

Hello,

need some help, I am trying to build a search box so when someone searches for a name on our page it will find, kind of like when you search by ctrl F

does any one already have pre-existing code build?

I try using a couple of snips from bootsnip but seems it doesn't work for whatever reason

This topic has been closed for replies.

4 replies

Legend
October 30, 2018
Paul-M - Community Expert
Known Participant
October 29, 2018

Hi

I guess not explaining well..

<Moderator: Removed image as it contained personal info>

this is what I am looking for.. please see image.

Nancy OShea
Community Expert
Community Expert
October 29, 2018

You have my answers above.  What you're attempting to do won't work in all browsers.   Here's why

Window.find() - Web APIs | MDN

Nancy O'Shea— Product User & Community Expert
Nancy OShea
Community Expert
Community Expert
October 29, 2018

You'll need to get your content indexed into a searchable database and connect your search form to  a related search engine.  You can use Goolge's search API or if you prefer, another 3rd party service like Freefind.  Or you could buy Zoom desktop search engine.

Nancy O'Shea— Product User & Community Expert
B i r n o u
Legend
October 29, 2018

it is sometimes not useful to take out semi-trailers when the simple trunk of a car can be enough.... without any deterioration for the OP request, it is impressive the volume of data that mysql can manage when the text fields are simply indexed by the internal attribute on full text

Nancy OShea
Community Expert
Community Expert
October 29, 2018

I could be wrong but I'm willing to bet the OP's site is static HTML and he  doesn't have a MySQL database to query.  That's why I mentioned Google, Freefind and Zoom.

Nancy O'Shea— Product User & Community Expert
B i r n o u
Legend
October 29, 2018

a simple request to your database containing the title is good enought... just think to wrap you search query by a %% pair to open  an in between word.

B i r n o u
Legend
October 29, 2018

you can have some more details there

https://sql.sh/cours/where/like