JQuery does not execute on $(document).change()

后端 未结 3 1637
生来不讨喜
生来不讨喜 2020-12-06 02:18

I need to make some JQuery execute when the page/document has changed - in this case, when a div with a specific CSS class is displayed.

I have the following JQuery

3条回答
  •  醉话见心
    2020-12-06 03:01

    Your syntax is wrong too buddy! If you're going to do it, do it within document ready, .change is very limited and wont fire on a new page.

    $(document).ready(function(){
        if($('.classOrId').length){
            //do something if it exists
        };
    });
    

提交回复
热议问题