Beaver Builder: deactivate custom JS on BB Edit mode

Photo by Jess Bailey on Unsplash

Beaver Builder: deactivate custom JS on BB Edit mode

Yuki R.'s photo
Yuki R.
·Aug 4, 2022·

1 min read

When you add a custom JavaScript code in a Layout CSS/JS field it affect BB edit mode as well. But not always you want the function when you editing a page. This snippet ( typeof FLBuilder != 'undefined' ) will deactivate the function.

Deactivate on BB edit.png

(function ($) {

  $(document).ready(function() {
    if ( typeof FLBuilder != 'undefined' ) {//deactivate on BB edit mode
      return;
    }else{

      //Do your magic here
      $("button").click(function(){
        $("p").hide();
      });

    }
  });

})(jQuery);
 
Share this