When doing the project, the boss let me encapsulate a search function, similar to Baidu
After entering the character, you can automatically search for data, and there will be a drop-down box for the user to choose, I think my boss has a problem, there are so many plug-ins on the net, not only the package, performance has also been optimized, what functions have, he does not, must I use the original JS write, write yarn, I spit in the But still want to do, in order to pay and bow, so I this small white will bite the bullet, there must be a lot of shortcomings, there is no encapsulation, is to think where to write where, to everyone when the negative view, if you see, you can point to me, let me progress
Because I was written in the project, so there are a lot of things and everyone's affirmation is not the same, look at the idea on the line, the details can be seen, but there must be a problem, the HTML code to look at their own wording, I was to the search box to add the KeyUp event, the Change event can also, But one drawback is that it's not a good idea to lose focus.
This is the search data.
This is a drop-down box, this is a bit complicated, because it also involves clicking on other places to hide and click the search box to display the problem, it is very simple to say, but it is not so easy to do, I write when the head is messy, so the code is very messy
JS search box for automatic search function