我有一个包含 2 个或更多类名的 jQuery 对象 (thisClass)。我试图弄清楚如何只返回预定数组中的类名。
像这样的东西:
var thisClass = $(this).attr("class");
var icons = ["glass","leaf","dog","home"];
[Use grep here to return thisClass only as a single class name that is filtered by, or contained in icons.]