0
我有一個包含2個或更多類名的jQuery對象(thisClass)。我想弄清楚如何只返回預定數組中的類名。在jQuery中的grep字符串
事情是這樣的:
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.]
你要找http://stackoverflow.com/questions/3196613/jquery-determine-if-ul-has-class-or-another-one什麼? – Colleen
我認爲你正在尋找類方法。 http://api.jquery.com/hasClass/ – thatidiotguy