In the layout, I have a menu that contains some ul and li.I have three levels`. This code is a bit of a sample:<li class=@(IsAny(MVC.Admin.Setting.Name) ? active : )>    <a href=#><i class=fa fa-paperclip></i> <span class=nav-label>reports</span><span class=fa arrow></span></a>    <ul class=nav nav-second-level>        <li class=@(IsAny(Failure,FailureCostByLocation) ? active : )>            <a href=#>text <span class=fa arrow></span></a>            <ul class=nav nav-third-level>                <li class=@(Is(ReportCostByData) ? active : )><a href=@Url.Action(MVC.Admin.Failure.ReportCostByData())>text</a></li>                <li class=@(Is(FailureCostByLocation) ? active : )><a href=@Url.Action(MVC.Admin.Failure.FailureCostByLocation())> text</a></li>            </ul>        </li>    </ul></li>To select the current menu item, I use this code: public bool IsAny(params string[] controllers)    {        return controllers.Any(c => Is(c));    }    public bool Is(string controller, string action = null)    {        if (ViewContext.RouteData.Values[Controller].ToString().ToLower() == controller.ToLower()            && (action == null ||             ViewContext.RouteData.Values[Action].ToString().ToLower() == action.ToLower()))            return true;        return false;    }If I use jQuery, is it better than this one on page load speed?  Or is there a way to do this in faster way?The jQuery code looks like this:(function(){    var current = 'current location';    $('#nav li a').each(function(){        var $this = $(this);        // if the current path is like this link, make it active        if($this.attr('href').indexOf(current) !== -1){            $this.addClass('active');        }    })})
Add active class to current menu with extension method or jQuery
c#;jquery;comparative review;mvc