Hy All ,
I have Algorithm but I do not know how code
My Algorithm
1. if value in class1 same like value in class2 then class2 it's
will be displaying
ex: if I'm Selected value 1 than every class2 which has value 2
it's will be displaying
2. if the value of the class 1 is not present in class 2, the value will
be in the show all
for more please check :
https://jsfiddle.net/badvz/5aRvF/312/