What I am wanting to do is add a class to a specific element with a specific url. But I can't seem to get it to work.
This is what I have.
var pageName = window.location.pathname
pageName = pageName.replace("/", "");
$("div.mainleftmenu a.rtsLink.rtsRoot[href=pageName]").addclass("rtsSelected");
If it helps a.rtsLink.rtsRoot is several steps into the hierarchy. I'm new to jQuery.
Update
Thanks for the quick response, but I am still getting an error.
TypeError: Object [object Object] has no method 'addclass' [http://XXXXXXX/training-events:69]
Here is a sample of the markup I am trying to traverse. (And this is auto-generated so modifying the html is not an option.)
<div class="mainleftmenu">
<div id="mainleftmenu_T76A8AA8B013">
<div id="ctl00_mainleftmenu_T76A8AA8B013_ctl00_ctl00_siteMapControl_verticalsimple"
class="RadTabStripVertical RadTabStrip_mainleftmenu RadTabStripLeft_mainleftmenu">
<div class="rtsLevel rtsLevel1">
<ul class="rtsUL">
<li class="rtsLI rtsFirst">
<a class="rtsLink rtsRoot" href="products">
<span class="rtsOut">
<span class="rtsIn">
<span class="rtsTxt">Products</span>
</span>
</span>
</a>
</li>
<li class="rtsLI">
<a class="rtsLink" href="products/heavybid">
<span class="rtsOut">
<span class="rtsIn">
<span class="rtsTxt">HeavyBid</span>
</span>
</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>