0

How to work a search bar without regex or any library in JavaScript .?

When I am trying to make search bar there is a problem . You can see in that code . I don't know what to write in the if statement . In this case when I type any key ,then the body shows " sorry , not found " . The need is when I am press "s / sa/ sam ... Samsung" then the body should show the 'samsung m31 phone' . How can I do that .? What I am writing in the if statement .. I have lack of logics , i want to improve that .. So , also could anyone tell me the idea .. https://code.sololearn.com/WXEay3VfxvGp/?ref=app

27th Mar 2021, 9:02 AM
ShamsuCm
3 ответов
+ 1
You don't need to do anything for a match; You only need to hide the mismatch. The if condition should be mismatch, and add display: "none" to the mismatch element
28th Mar 2021, 6:13 PM
Gordon
Gordon - avatar
0
Please anyone tell me.
27th Mar 2021, 9:53 AM
ShamsuCm
0
.
27th Mar 2021, 2:20 PM
ShamsuCm