Reputation: 25
I'm using the Sidr in Wordpress to creata a mobile navigation and I'm trying to make collapsible submenus on click but failed. Here's my code but doesn't work.
$(function(){
$('.sidr-class-menu-item-has-children').each(function(){ // Each menu item with children
$(this).on('click',function(){ // ...When clicked
$(this).find('.sidr-class-sub-menu').show(); // Show sub menu
});
});
});
Any tips or help will be greatly appreciated.
Upvotes: 0
Views: 461
Reputation: 26
You can add code as same:
jQuery(document).ready(function(){
$('.sidr-class-menu-item-has-children').each(function(){ // Each menu item with children
$(this).on('click',function(){ // ...When clicked
$(this).find('.sidr-class-sub-menu').show(); // Show sub menu
});
});
});
If no work, you can change $ to jQuery
Upvotes: 1