I have created list of anchors.On clicking the link,I want to add CSS Class(using addClass) to the link I have clicked upon.
<ul id = "menu">
<li id="mnuLectures" runat="server">
<asp:HyperLink NavigateUrl = "~/Lectures.aspx" Text="Lectures" runat = "server" ID= "hypLectures" />
</li>
<li id="mnuBooks" runat="server">
<asp:HyperLink NavigateUrl = "~/Books.aspx" Text="Books" runat = "server" ID= "hypBooks" />
</li>
<li id="mnuArticles" runat="server">
<asp:HyperLink NavigateUrl = "~/Articles.aspx" Text="Articles" runat = "server" ID= "hypArticles" />
</li>
<li id="mnuQA" runat="server">
<asp:HyperLink NavigateUrl = "~/QuestionAnswers.aspx" Text="Q & A" runat = "server" ID= "hypQA" />
</li>
</ul>
and JQuery,
$(document).ready(function () {
$('#menu li a').click(function () {
$(this).addClass('highlight');
});
});
The jquery code is not working properly.I am not able to add CSS class to clicked anchor.. Am I missing something or the approach is wrong..Please suggest