I have a default array for example
a=["and","a","in","&"] etc...
Iam getting a dynamic text, which iam converting it into an array. for example.
b=["harry","in","connect"]
I need to highlight by avoiding “in” the array.
So harry and connect will be highlight but not the in?
How to compare or check the array in jquery?
you can use
$.inArrayor$.grep, i.e.This will return a new array, containing only the words NOT present in array
aHere’s a fiddle: http://jsfiddle.net/kaFvw/
If you need it to return an array with all the words PRESENT in array
a, just change the==operator to!=