JAVASCRIPT stop running in global customizer

hi,

I was using this code to open the buttons on the main page url https://tarekrabaa.com <script> jQuery( function($) { $('.my').on('click', function() { $('.sfm-navicon-button').click(); $('.sfm-navicon-button').tap(); } ); } ); </script>

This code was placed in the global customized Javascript and it was running normally. Suddenly it is not working anymore, I put it back in the raw text content to run it again.

Why it has stopped working in the global customizer?

Thx

Hi There,

Thanks for writing in! Could you please try adding your code without script tags and see if that helps.

<script> </script>

Thanks!

Hi,

I added it in global customizer without . It is not working.
It was working before and now it stopped.’

I put the code directly in the page it works.

Hi There,

Could you please try replacing your custom JS with the following code?

jQuery(document).ready(function($) {
	$(document).on('click touchend', '.my', function(event) {
		event.preventDefault();
		$('.sfm-navicon-button').trigger('click');
	});
});

Let us know how it goes!

It didn’t work

Hi @tarekr,

As I checked your site, the button is working but it is not on global customizer. This could be because of the other script in your customizer.

To test it, remove and backup your script then add your script above.

Let us know how it goes.

Thanks.

1 Like

Yes it is true.

Why Alexa script is interfering on other scripts?

HI,

Can you share to us your other scripts so we can check.

Thanks

Hi there,

I suggest that you add the 3rd party scripts to the header of the HTML code. Please follow the steps below:

  1. Install the Child Theme.
  2. Add the code below to functions.php file of the child theme:
add_action('wp_head', 'head_information', 9999);

function head_information () { ?>
<!-- Your HTML Code Here -->
<?php }

Change <!-- Your HTML Code Here --> with the code you have. In this case, you need to keep the <script> in contrary to the X > Theme Options > JS.

If you still have problems kindly get back to us with the result of the steps above and URL/User/Pass of your WordPress dashboard using the Secure Note functionality of the post to follow up the case.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.