{"id":5981579,"date":"2015-04-05T19:01:19","date_gmt":"2015-04-05T19:01:19","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/adding-js-to-wordpress-menu-item\/"},"modified":"2016-08-24T14:25:32","modified_gmt":"2016-08-24T14:25:32","slug":"adding-js-to-wordpress-menu-item","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/adding-js-to-wordpress-menu-item\/","title":{"rendered":"Adding JS to wordpress menu item"},"content":{"rendered":"<p>Trying to customize a wordpress menu list item. The menu was created through the wordpress admin panel. I am unable attach the javascript function show\/hide to a specific wordpress menu list item.<\/p>\n<p>I have added a class to the menu list item through the wordpress admin area &gt; screen options &gt; CSS Classes. However this class is not triggering the javascript function show\/hide.<\/p>\n<p>What am I missing to in order to attach the javascript function to the wordpress generated navigation menu?<\/p>\n<p>$(document).ready(function(){<br \/>\n     $(&#8220;.hide&#8221;).click(function(){<br \/>\n          $(&#8220;.webform&#8221;).hide(500);<br \/>\n      });<br \/>\n      $(&#8220;.show&#8221;).click(function(){<br \/>\n          $(&#8220;.webform&#8221;).show(500);<br \/>\n      });<br \/>\n });<\/p>\n","protected":false},"template":"","class_list":["post-5981579","topic","type-topic","status-closed","hentry","topic-tag-js","topic-tag-menu"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5981579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5981579\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=5981579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}