Let’s the following is our input type, wherein the user will search −

Now, use hide() and show() to display only relevant search and hide rest. For example, on typing “Ja”, related keywords like “Java” and “JavaScript” should be visible because it begins with “Ja”.


 Live Demo


To run the above program, save the file name “anyName.html(index.html)” and right click on the file. Select the option “Open with Live Server” in VS Code editor.


This will produce the following output −

Now, I am entering the only Java and getting the search result. The screenshot is as follows −

Look at the above snapshot, remaining list of items are hiding.

Published on 10-Sep-2020 07:24:31

Not affiliated with Tutorialspoint