My JSFiddle Code works perfectly within the workspace. Just trying to do a simply show/hide of a menu that has children:

$('#menu-product-categories .sub-menu').hide(); //Hide children by default
$('#menu-product-categories li a').click(function(event){
    if ($(this).next('ul.sub-menu').children().length !== 0) {     
        event.preventDefault();
    }
$(this).siblings('.sub-menu').slideToggle('slow');
});

However, when I take that same exact code and put it into my wordpress site, it does not function. I’m adding the jquery to the header of the site exactly how it is done within the JSFiddle, and I directly copy/pasted the menu structure from my wordpress site. I don’t see how this can happen? Any advice would be helpful

Thanks for your time.

Read more here: JSFiddle Code working, but not working when in wordpress?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: