Wait until HTML elements gets a class then do something

前端 未结 3 608
你的背包
你的背包 2021-02-08 22:16

I am waiting for the document.ready event in order to do something on my page.

Alas some other script, which I cannot change, has not worked its magic yet once my script

3条回答
  •  清歌不尽
    2021-02-08 23:06

    I'm sorry if I got your question wrong but why not just doing something plain as this on document.ready ? :

    $("#myelement").addClass('myclass');
    
    if($("#myelement").hasClass('myclass')) {
        alert('do stuff here');
    }
    

提交回复
热议问题