Wait until HTML elements gets a class then do something

前端 未结 3 549
你的背包
你的背包 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 22:58

    You could trigger some event once you added the class.

    Example:

    $('#ele').addClass('theClass');
    $(document).trigger('classGiven')
    
    
    $(document).bind('classGiven',function(){
        //do what you need
    });
    

提交回复
热议问题