{"id":4505038,"date":"2014-01-15T07:19:32","date_gmt":"2014-01-15T07:19:32","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/showhide-code-snippets\/"},"modified":"2016-08-21T14:46:43","modified_gmt":"2016-08-21T14:46:43","slug":"showhide-code-snippets","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/showhide-code-snippets\/","title":{"rendered":"Show\/Hide Code Snippets"},"content":{"rendered":"<p>Hello!<\/p>\n<p>I must first say, I really like this plugin and it&#8217;s awesome! I would like to create some buttons to show and hide these code snippets because they can get lengthy. However my code does not work and I can&#8217;t seem to understand why.<\/p>\n<p>&lt;button class=&#8221;codeButtons&#8221; onclick=&#8221;show(&#8216;code6&#8217;)&#8221;&gt;Show Me&lt;\/button&gt; &lt;button class=&#8221;codeButtons&#8221; onclick=&#8221;hide(&#8216;code6&#8217;)&#8221;&gt;Hide&lt;\/button&gt;<br \/>\n&lt;\/p&gt;<br \/>\n&lt;div id=&#8221;code6&#8243; style=&#8221;display:none;&#8221;&gt;[snippet id=&#8221;52&#8243;]&lt;\/div&gt;<\/p>\n<p>and the functions show and hide are:<br \/>\nfunction hide(name)<br \/>\n{<br \/>\n\tdocument.getElementById(name).style.display=&#8221;none&#8221;;<br \/>\n}<\/p>\n<p>function show(name)<br \/>\n{<br \/>\n\tdocument.getElementById(name).style.display=&#8221;block&#8221;;<br \/>\n}<\/p>\n<p>&#8211; When I press the show button, it reveals the div but not the code snippet. Do you have any advice as to how I can solve this issue?<\/p>\n<p>https:\/\/wordpress.org\/plugins\/code-snippet-library\/<\/p>\n","protected":false},"template":"","class_list":["post-4505038","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4505038","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\/4505038\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=4505038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}