针对元素的第二类并针对具有相同类

时间:2016-11-29 22:10:51

标签: jquery

我试图在这里解决$ theSecondClass。

div与班级" hr - department"有一个第二类helloWorld,我想获得该类名,并检查具有相同类名的其他div。然后我想对所有具有该类名称的div做一些事情。现在我知道我可以简单地定位" helloWorld",但我实际上需要一个循环,因为第二个类名将为每个div的var。我可以使用ID,但我仍然无法更频繁地匹配类名。



var $currentDept;
//$previousDept;

$(".hr--department").click(function(){
	
	$currentDept = $theSecondClass;
	
	$($theSecondClass).each(function(){
		$(this).addClass("isOpen");
	});

});
	




0 个答案:

没有答案