// try using jQuery to check if the body element has the elementor class // if not, then its safe to execute your code :) if(!jQuery('body').hasClass("elementor-editor-active")) { // add your code here... console.log('working!'); }