正如标题所示,我想通过单击另一个 div(“div.secondclass”)来获取动态 div 的类。这是我的代码:
$(document).ready(function() {
$("div.secondclass").click(function () {
firstclass=$('#firstid').attr('class');
alert("the class of the 1st div is ="+firstclass);
});
});