2013-10-16 35 views

回答

1

的父DIV我想你可以得到它通過簡單的jQuery示例。以下片段將會有所幫助。

$('h3').each(function(){ 
    if($(this).parent().attr("class")=="open"){ 
      $(this).attr("class","on") 
     } 
}); 

相同的輸出可以通過下面的單線代碼

$(".open h3").attr('class',"on"); 
可以實現