I am trying to to create auto suggest element manually. I am using canjs for this prupose.
Following code I have tried so far:
list.filter( function( item, index, list ) {
if(item.includes(searchText) && searchText != ''){
//css hide and show classes for match
}
else{
// css show for unmatched results
}
})
In above code I am facing two problems:
includes does not work in all browsers. For that I have tried match,
contains and sub-string but they could not help me.includes working in chrome but when I entered the string whose substring is not contained by the last element of list it will not
work because filter will keep searching from all the elements.
Is there any mistake I am doing?
I want to it to run in all the browser.
Thank you.