SO - 17337752
by Nabaraj Saha
HTML
<form>
<input type="checkbox" value="one" />
<input type="checkbox" value="two" />
<input type="checkbox" value="three" />
<input type="checkbox" value="four" />
<input type="checkbox" value="five" />
</form>
JavaScript
var names = ["one","two","three"];
$("form :checkbox").filter(function(){
return $.inArray(this.value, names) > -1
}).addClass("blue")
$("form :checkbox").filter(function(){
return $.inArray(this.value, names) == -1
}).addClass("green")