I have this in my html code:
<ul id="navlist"
<li id="tabItem1"><a href="#">Item one</a></li>
<li id="tabItem2"><a href="#">Item two</a></li>
<li id="tabItem3"><a href="#">Item three</a></li>
<li id="tabItem4"><a href="#">Item four</a></li>
</ul>
I want to add a class to the a element with jquery like this: (its not working)
var currentTab = 1;
$(document).ready(function()
{
$("li#tabItem" + currentTab + ":has(a)").addClass("navlistHover");
//console.log("li#tabItem" + currentTab + ":has(a)");
});
When a delete the a element and do it like the next example, than there is no problem.
$("li#tabItem" + currentTab).addClass("navlistHover");