How to add onclick function in wordpress menu item to show page section (display: none;)
I am trying to add a onclick function to a menu item in WordPress. I am trying with this old-school code, but it’s not working.
I use the same code as before that works for me, but obviously it’s not working now on this type:
<script> jQuery(document).ready(function(){ jQuery('#menu-item-1496').bind( "click", function() { jQuery ('#products').show(); }); }); </script>
What I want to make is, when you click on menu item(now they are just linked to sections, like Scroll to ID), to show section that is linked to. I’ve added CSS: display:none; but the JS code is not working.. I want it hidden section by default, and when you click on menu item to lead you to that section and appear.. Is that possible with JS?