I have a div which contains an anchor tag as below.
<div id="sideTabs">
<a href="#" type="click" >
Click Here
</a>
</div>
For some reasons I cannot set id or class on anchor tag and there is a attribute type
in the anchor tag.
I have a CSS class
.selected {
background: rgb(41, 41, 59);
color: #fff;
}
I want to add this class dynamically when I click on anchor tag.
I know how to add a CSS class with reference to id
and class
.
$(#"id of anchortag").attr("class", selected);
As I do not have id attribute can some one explain me how to add a CSS class with some other attribute, in my case type
.