[Support request] A Strange Question

Home Forums Support [Support request] A Strange Question

Home Forums Support A Strange Question

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1166920
    Joezer

    Hello,

    I don’t think this has been asked before but how do you do the “Are you happy with our support? Yes No”. It’s brilliant. I think I can use it to hide my social media buttons. Always to put those buttons but no matter which plugin I use, it always looks ugly. I think it can also be nice to implement it somewhere inside the article and ask a question to the reader in the middle of the article and whichever they answer, they will be pointed to a link. ๐Ÿ™‚

    #1167307
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    It’s some pretty simple HTML and jQuery.

    For example, the HTML:

    <div class="review-container">
        <p>
            Are you happy with our support? <span class="happy">Yes</span>&nbsp;&nbsp;<span class="unhappy">No</span>
        </p>
    
        <div class="happy" style="display: none;">
            <p>Great to hear!</p>
        </div>
    
        <div class="unhappy" style="display: none;">
            <p>Sorry to hear that!</p>
        </div>
    </div>

    And the jQuery:

    $( '.review-container span.happy' ).on( 'click', function() {
        var _this = $( this );
    
        _this.closest( 'p' ).hide();
        _this.closest( '.review-container' ).find( 'div.happy' ).show();
    } );
    
    $( '.review-container span.unhappy' ).on( 'click', function() {
        var _this = $( this );
    
        _this.closest( 'p' ).hide();
        _this.closest( '.review-container' ).find( 'div.unhappy' ).show();
    } );

    There are other ways to do it as well if you Google “jQuery show hide toggle” ๐Ÿ™‚

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.