How to make a working search bar? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make a working search bar?

Like when you have a website and you want to put a working search bar that will search for the content of your website and will redirect the page to it.

16th Sep 2017, 9:13 AM
Feelc
2 Answers
+ 12
If it's a single page or small website then you'd be good to go with JavaScript, see this code as an example: https://code.sololearn.com/WDgz98tos3U9/?ref=app But if it's a big website, most likely it is going to be with a server-side script. A script like this could be index-based or non-index-based. For example, you could write a search engine script with JavaScript and PHP that uses MySQL to store your website's indexed pages and the search results could be loaded with Ajax.
16th Sep 2017, 11:39 AM
Pao
Pao - avatar
+ 8
I would recommend you to get the search input with Javascript, then compare it with every content supposed to be searched (arrays and loops) in your website
16th Sep 2017, 9:16 AM
Dapper Mink
Dapper Mink - avatar