How can you show/hide posts without using a plugin?
-
I’m using js toggle but it’s very problematic. Does anyone have a better way of doing so without using plugin?
Code (problematic):
<h6 id=”showhide”>Hide Posts</h6>
<h6 id=”showhide” style=”display: none”>Show Posts</h6><!—jQuery for the animated show hide effect. Takes place from under the first h6 tag to the next h6 tag—>
<script type=”text/javascript”src=”https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js”></script><script type=”text/javascript”>
jQuery( function( $ ) {
$(‘h6#showhide’).click( function() {
$(‘h6#showhide’).nextUntil(‘h6#showhide’).toggle(600);
} );
} );/*Show or Hide Appears*/
$( “h6#showhide” ).click(function() {
$( “h6#showhide” ).toggle();
} );</script>
- The topic ‘How can you show/hide posts without using a plugin?’ is closed to new replies.