Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Hide div / element if user signed in

422422 MVP
edited December 2011 in Vanilla 2.0 - 2.8

Ok this is a html request but need some help please.

I have a div, and wish to hide that div if user is signed in.

@Todd did some code earlier, but not sure how to accomplish what I want. I suppose I would or could display:none but... anyhoo..


< script language="javascript">
                        jQuery(document).ready(function($) {
                        if (gdn.definition('SignedIn', '0') != '0') {
                            < div class="sp-container">
                                
                            < /div>
                        }
                        });
                        < /script>

I wish to hide content of sp-container if user not logged in. Tried using Todds code but I am pretty crap with js etc.

There was an error rendering this rich post.

Best Answer

  • x00x00 MVP
    Answer ✓
    $('.sp-container').hide();

    or

    $('.sp-container').css({'visibility':'hidden'});

    If you want to keep the space.

    grep is your friend.

Answers

  • Have ur div in page and in script in { } try something like

    $('.sp-container').css('display' , 'none');

    Or $('.sp-container').html(' '); to clear all content of div

    There was an error rendering this rich post.

  • x00x00 MVP
    Answer ✓
    $('.sp-container').hide();

    or

    $('.sp-container').css({'visibility':'hidden'});

    If you want to keep the space.

    grep is your friend.

  • Brilliant thanks guys, I opted for .hide method. Thanks a million

    There was an error rendering this rich post.

Sign In or Register to comment.