Can't get jquery function to work on wordpress site

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Can't get jquery function to work on wordpress site



My jquery function works fine on local, but once I add it to my WP footer and upload, nothing.



Link to page: https://divipaint.wpengine.com/



There are a lot of scripts on this page, the but the script I'm trying to make work is this:


jQuery(document).ready(function($)
$("li.accordion").on('click',function()
$('.mega-sub-menu', this).slideToggle("fast", function() );
);
);



Jquery is loaded and working, but this script won't function.



Any ideas?



EDIT: Thanks, but it wasn't the stray '



I seemed to be having a cache issue on the site, which has been updated now. Still having the problem.





do you have any <li> with class including accordion .. do these <li> have a child element with class including mega-sub-menu? Are there any errors in the developer tools console when loading your site - i.e. the stray ' on line 2138 is probably the problem - also, when you fix that, you actually use, in your code, jQuery not $ ... but you also use jquery which isn't jQuery because q isn't Q
– Jaromanda X
38 mins ago



<li>


accordion


<li>


mega-sub-menu


'


jQuery


$


jquery


jQuery


q


Q





I have an error but nothing related to this. Everything works locally — I copied the menu straight from the dev site, so it's exactly the same structure locally as it is online. Looks like you might be getting served a cached version. I'll see if I can clear it
– Tomasch
22 mins ago





jQuery(document).ready().... should be replaced with jQuery(function($){..., you will be getting a deprecated function warnings.
– NoBugs
1 min ago



jQuery(document).ready()


jQuery(function($){...




1 Answer
1



Your site has a syntax error on it. There is a quote at the end of your JavaScript which may well be causing it to not execute.


jQuery(document).ready(function()
jquery("li.accordion").click(function()
jquery('.mega-sub-menu', this).slideToggle("fast", function() );
);
);' <--- quote here





Yeah, and I've fixed that but now of course I'm having a caching error of some sort
– Tomasch
11 mins ago






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered