This $("a[href='Menu/appetizersandpizza.aspx']").addClass("current"); work
for me... Look:

http://jsbin.com/imoju/edit


On Mon, May 11, 2009 at 18:15, Matt <matt.marc...@gmail.com> wrote:

>
> This seems like such a simple basic task, but I can't seem to get the
> syntax correct.  I have a menu, and using jQuery it adds a class
> (.current) to the link that corresponds to the current page.  This
> works for all pages except the page in a subdirectory (link below
> marked with a *).
>
>        <div id="menu" class="basictab">
>          <ul>
>                        <li><asp:hyperlink NavigateUrl="Default.aspx"
> runat="server"
> id="lnkDefault">Home</asp:hyperlink></li>
>                        *<li><asp:hyperlink NavigateUrl="Menu/
> appetizersandpizza.aspx" runat="server" ID="Hyperlink1">Menu</
> asp:hyperlink></li>
>                        <li><asp:hyperlink NavigateUrl="#" runat="server"
> ID="lnkCatering">Catering</asp:hyperlink></li>
>                        <li><asp:hyperlink NavigateUrl="Location.aspx"
> runat="server" ID="lnkLocation">Location</asp:hyperlink></li>
>          </ul>
>        </div>
>
> Here is the jQuery call that I am using for the default.aspx page.
>
>     $("a[href='Default.aspx']").addClass("current");
>
> Here are a few of the different things I have tried for the link with
> the submenu (obviously only one at a time).
>
>      $("a[href*=/Menu]").addClass("current");
>      $("a[href='Menu/appetizersandpizza.aspx']").addClass("current");
>      $("a[href*=/Menu]:first").addClass("current");
>
> Can anyone shed some light on what I can try (I'm still pretty new to
> jQuery).  Thanks in advance.
>

Reply via email to