I need assistance with modifying a list on my webpage. Here is the current structure:
<ul id="breadcrumbs" class="breadcrumbs-two">
<li><a href="#" class="current" id="a1">Step1</a></li>
<li><a href="#" id="a2">Step2</a></li>
<li><a href="#" id="a3">Step3</a></li>
<li><a href="#" id="a4">Step4</a></li>
<li><a href="#" id="a5">Complete</a></li>
</ul>
I want to apply a CSS class to an anchor tag when a specific link button is clicked.
The CSS code to be applied is as follows:
.breadcrumbs-two .current
{
background: #99db76;
}
.breadcrumbs-two .current, .breadcrumbs-two .current:after
{
border-left-color: #99db76;
}
.breadcrumbs-two .current, .breadcrumbs-two .current:before
{
border-color: #99db76 #99db76 #99db76 transparent;
}
How can this be achieved?
I attempted the following approach
function addClass(dis) {
dis.className += "current";
}
<li><a href="javascript:addClass(this)" id="a1">Step1</a></li>
<asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="addClass('a1')">Done</asp:LinkButton>
However, it is not functioning as expected.
If anyone could provide guidance, I would greatly appreciate it.
Thank you in advance. Gulrej