Matching Strings

by Elijah Tate

HTML

<div class="main">
    <input class="featureChbx" type="checkbox" data-feature="wireless">Wireless</div>
<input class="featureChbx" type="checkbox" data-feature="bluetooth">BlueTooth</div>
<div class="parent">
    <div class="divFeat blue" data-feature="wireless_bluetooth"></div>
    <div class="divFeat black" data-feature="wireless"></div>
    <div class="divFeat gray" data-feature="bluetooth"></div>
</div>
</div>

JavaScript

var features = "bluetooth bluetrack wireless";

var filter = ["wireless", "bluetooth"];

$.each(filter, function(indx, val){
   if(features.toLowerCase().indexOf(val) > -1){
    	alert("there is a match " + val + features);   
   }
});