Auto Search using JavaScript
Auto Search Using JavaScript
Details: Auto Search using JavaScript
When searching for information, humans use natural language processing to perform an auto search. Auto searches are performed by software that analyzes text, and produce a result based on the analysis. In the past, auto searches were performed manually by people using computers.
However, as people have become more educated and as computers have become more sophisticated, humans have shifted their focus to the manual aspects of auto searches. Currently, many scholars argue about the pros and cons of performing auto searches versus performing manual ones. According to a study published in 2017 in the journal Science Advances, humans are performing more than 500 billion auto searches per year. Therefore, it is crucial to understand how we perform these searches and what changes could improve our efficiency.
Interface: Auto Search using JavaScript
Auto Search program can help you search for data in a particular row. It has a code you can modify or adjust to suit your user experience. To have a better understanding of this app, just follow the procedure below. First, you download the bootstrap framework. Here’s the link for the download. https://getbootstrap.com/.
The code contains the point of interaction of the application. To make this simply compose these blocks of code inside the text editor and save as index.html.
Auto Search Using JavaScript
Member List
Creating the Script: Auto Search using JavaScript
This code will search for a particular keyword automatically. To do this copy or write these codes in the text editor, and save it as script.js inside the js folder.
var members = ['Tony Stark', 'Jin Mori', 'Luke Cage'];
displayMember();
function displayMember(){
members.sort(function(a,b){
if(a < b){
return -1;
}
if(a > b){
return 1;
}
return 0;
});
data = "";
for(var i=0; i < members.length; i++){
data += ""+members[i]+" ";
}
document.getElementById('result').innerHTML = data;
}
function autoSearch(){
var search=document.getElementById('search').value.toLowerCase();
var parent=document.getElementById("result");
var children=parent.getElementsByTagName('tr');
for(var i=0; i-1){
children[i].style.display="";
}else{
children[i].style.display = "none";
}
}
}
Auto Search using JavaScript: Output
There you go, we effectively made this example.