简体   繁体   中英

Add Class to another element when class is added to body

I am trying to check for when a class is added to the body but my code isn't working, is anyone able to help me?

function checkFordone() {
    if ($("body").hasClass("done")) {
        $("#mainbar").addclass("finished");
    } else {
        setTimeout(checkFordone, 100);
    }
}

jsFiddle

addclass不是函数,请使用addClass!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM