Problems in edit mode if I have jQuery in the settings window ...

Hi
There should be a way to disable the jQuery for a page in edit mode. For instance in this page http://olle.dyndns-ip.com/stockholmsbuddhistcenter/retreater/ I have a click event on the 12 DEC- 13 DEC button (in the bottom) that loads another page under it with Ajax. If I start the Builder and try to edit the text in the button 12 DEC- 13 DEC. It loads the Ajax page and not the BB window. How should I handle this? I can’t ask the client to comment out the jQuery everytime they want to edit.

Also earlier today. I made a typo in the Javascript window an saved the page. After that the page could not be edited anymore. None of the pages. Javascript was in the Global Settings.
I had to go in to the database and edit / remove the bad jQuery. Then it started to work again.

Regards
Olle

Hi Ollie,

jQuery is loaded by WordPress. Therefore, if you want to disable it on that page, then you’re probably going to need to use the wp_dequeue_script();. I believe you can use the WordPress conditional tags is_page to dequeue the script for that page only. However, to get the correct instructions, you’ll want to ask this on the WordPress Support forums.

https://codex.wordpress.org/Function_Reference/wp_dequeue_script

If you make a mistake on a page or adding scripts to the Layout Settings. You can remove these changes I using the WordPress Revision option via the edit page screen.

Thanks,
Danny

Hi
Maybe I explained poorly. Because you missed the whole point.

If I put som jQuery in the layout settings or global settings. It can interfere with BB edit mode in such a way that edits is not possible.

So if I put a click event on a text module the jQuery in the layout setting will execute before the BB text edit widow opens. It will not open at all.

Also. If I make an error in the jQuery in the layout settings. The whole BB plugin will become unusable. No buttons respond to anything.
The WordPress Revision does not take me back to the previous page. It does not recognize the edits in the Layout settings window apparently.

So where shall I put my jQuery to be safe?

Regards
Olle

Ok, so i found a temporary solution.
If I move the jQuery to some other place. Open BB edit. Open Layout Setting - Javascript. Save Layout setting. I can edit the text module.

If I save the page. And go back in BB edit mode I have to repeat that again if I want to edit.

This is the jQuery if interested.

jQuery(document).ready(function(){
        jQuery.ajaxSetup({cache:false});
        jQuery(".kurser-box").click(function(e){
e.preventDefault();
            var externalpagepart = ' #ladda';
            var post_link = jQuery(this).find("a").attr("href") + externalpagepart;
            jQuery("#laddare").html("laddar innheåll");
            jQuery("#laddare").load(post_link);
        return false;
        });
    });

Regards
Olle

Hi Ollie,

Is the #laddare element wrapping the builder content? If so, then it is going to break as it will be replacing it.

So, as far as I am aware the only solution would be to either do what you’re doing or you could try this.

jQuery(document).ready(function(){
   if ( 'undefined' != typeof FLBuilder ) {
      return;
   }

Then add your code to that snippet, this should disable the script when the builder has been enabled.

Also, I apologise, I didn’t fully understand your question when you first posted. I assumed you wanted to disable jQuery.

Thanks,
Danny

Hi
Yes that was the case. The element targeted with jQuery was wrapping the flbuilder. So I understand why it made the flbuilder not to work. But adding your snippet it works fine. Thank you for that!!

Maybe a good idea to put some checkbox or something so developers can teporarily disable javascript in the settings windows?

Or remove it completely Maybe a button in the “clear cache” area?
The other scenario I described. Putting jQuery that have some errors in the settings window can completely set the flbuilder “out of work”. And I have to go in the database and clear it up.
Not so good.

I can give you the jQuery that destroyed my BB if you like so you can text it and reproduce it?

Regards
Olle

Hey Olle,

The JS on the layout settings breaking the builder issue should be fixed come 1.7.4. :slight_smile:

Ben

Ok. Good to know. Thank you.

Regards
Olle

No worries, Olle! Don’t hesitate to let us know if we can assist further! :slight_smile:

Ben