好吧,我知道如何添加class以及檢測div的類jQuery但現在我想在父div中獲取子類的類名,然後向持有子div的父div添加一個類或id。檢測父div內的子div類,然後添加class或id到父div
例如:
<div>
<div class="childdiv">this is the child divident</div>
</div>
後的股利子類已獲得或檢測再加入class和id父DIV(在我的情況,我用class
)..
輸出應該是:
<div class='parentclasshasbeenadded'>
<div class="childdiv">this is the childdiv</div>
</div>
這只是一個實驗,一旦得到那麼我會把這個應用到我的實際大爆炸項目中,請提前幫助我幫助我。
PS:我接受任何建議,建議和想法。
謝謝!像魅力一樣工作 –