Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Knockout.js Live Search Example
@zhangtreefish
Copy link

zhangtreefish commented Aug 7, 2015

Mr. Hinchley,
Thank you for sharing this live search method. It is awesome! I have a question:is
users[user].name.toLowerCase().indexOf(value.toLowerCase()) >= 0
some kind of string comparison method? Would you provide a documentation so I can look up some more? Thank you!

@pmrcunha
Copy link

pmrcunha commented Nov 9, 2015

@zhangtreefish, string.indexOf(param) returns the index of the first occurrence of param in string, and returns -1 if param can't be found in string.
Check it out here.
So basically what that line of code is saying is "if the string value exists in the string users[user].name, do something".

@ayushagnihotri24
Copy link

ayushagnihotri24 commented Jan 27, 2016

Mr. Hinchley,
Thank you for sharing this live search method. It is awesome! I have a question:

if i need to insert address field in it....it is inserted properly but while on searching it only search via name and id????

how to search it via address????

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment