I have an array with some values. How can I search that array using jquery for a value which is matched or close to it?
var a = [\"foo\",\"fool\",\"cool\",\"
Try the following js code
function likeMatch(q) { my_arr = ["foo","fool","cool","god"]; var rArr=[]; for(var t in my_arr) { if(my_arr[t].indexOf(q)>0) rArr.push(my_arr[t]); } return(rArr); }