Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8541653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:52:46+00:00 2026-06-11T11:52:46+00:00

I have a aproblem with a horizontal navigation I am using in a small

  • 0

I have a aproblem with a horizontal navigation I am using in a small asp.net project.
The nav contains a Login, Profile and Logout anchor, which are displayed if you are logged in, or not.

I am realizing this behaviour by setting .Visible attribute in Code Behind.

Now i want to add a pipe after every element as a “divider”. This must not be a part of the actual list item itself because it would screw over the a:hover effect.

But even if the element is not in the DOM tree, die pipe-divider is shown.
which looks like

Login | | |

I have tried solving it with

if ($("li.nav-item").length == 0) {
            $('span.divider').remove();
        }
        if ($("li.nav-item").length > 0 && $("li.nav-item").is(':visible')) {
            $('<span class="divider"> | </span>').appendTo('li.nav-item');
        }

but this doesnt work. How can I solve this?

Kind regards.

/edit: html markup (edited IDs)

<ul id="navigation">
                <li class="nav-item"><asp:HyperLink ID="link1" runat ="server" Text="LoremIpsum"      NavigateUrl="#" /></li>
                <li class="nav-item"><asp:LinkButton ID="LoremIpsum" runat ="server" Text="LoremIpsum" PostBackUrl="~/#.aspx"  /></li>
                <li class="nav-item"><asp:HyperLink ID="link2" runat="server"  Text="LoremIpsum" NavigateUrl="#.aspx"/></li>
                <li class="nav-item"><asp:HyperLink ID="linkLogin" runat="server" Text="Login" NavigateUrl="~/login.aspx"/></li>
                <li class="nav-item"><asp:HyperLink ID="linkProfile" runat="server" Text="Profile" NavigateUrl="~/profile.aspx" Visible="false"/></li>
                <li class="nav-item"><asp:HyperLink ID="linkLogout" runat="server" Text="Logout" NavigateUrl="~/logout.aspx" Visible="false"/></li>
                <li><asp:HyperLink ID="LoremIpsum" runat="server" Text="LoremIpsum" NavigateUrl="~/nutzungsbedingungen.aspx"/></li>
                </ul>


if (Session["svar_loggedin"] != null)
    {
        linkLogin.Visible = false;
        linkProfile.Visible = true;
        linkLogout.Visible = true;
    }
    else
    {
        linkLogin.Visible = true;
        linkProfile.Visible = false;
        linkLogout.Visible = false;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:52:47+00:00Added an answer on June 11, 2026 at 11:52 am

    Try this js instead:

    $.each($("li.nav-item").children("a").filter(":visible"), function (e) {
        $('<span class="divider"> | </span>').appendTo($(this));
    });
    

    EDIT:

    Either use css instead of Visible property:

    linkLogin.Attributes.Add("style", "display:none")
    

    or alt. iterate through the controls, check if visible == true, if so add the span-markup to the Text-attribute

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a problem with a little project. I have a navigation bar that
I have a problem using fadeIn() on div that contains elements which positions are
I have a problem automagically detecting my Arduino's serial port in Python, using Mac/Linux.
I have a horizontal scrolling website and depending on the scroll position I have
I have been using ItemsControl for quiet sometime in WPF. I am using MVVM
I have a WPF user control inside windows form project and I have a
I have a problem with my Android application. When I'm using my hp touchpad,
I want to create a horizontal scrollable ViewPager. My ViewPager contains Fragments. Each Fragment's
I have a problem which appears when using Ubuntu Linux/Gnome, but seemingly not on
I have something like this : <div style=width:1300px> <ul class=ul-length ul-textalign> <li class=li-horizontal> A

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.