• 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&gt;

    <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>

Viewing 1 replies (of 1 total)
  • Casey Driscoll

    (@caseypatrickdriscoll)

    Hi joewinfield91,

    Do you have a public link we can look at? Could you also be more specific of why this is problematic?

    It seems to be working for me: http://jsfiddle.net/U7m6Y/1/

    Typically using the same id for two elements is bad form, you’ll just run into too many problems.

    Other options include changing the text on a single element or using ‘show’ and ‘hide’ classes on two elements.

Viewing 1 replies (of 1 total)
  • The topic ‘How can you show/hide posts without using a plugin?’ is closed to new replies.