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.
(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);
ย