I'm new to javascript/jQuery and I'm trying to find the smartest way to trigger an event based on whether a id is active or not :
<ul class="tabs">
<li id="1" class="active"><a href="#"></a></li>
<li id="2"><a href="#"></a></li>
<li id="3"><a href="#"></a></li>
<li id="4"><a href="#"></a></li>
</ul>
It becomes a bit more difficult as the rule is as follow:
if id=1 is active, trigger alert("A") if id=2 is active trigger alert("B") if id=3 is active trigger alert("C") if id=4 is active trigger alert("D")
What function could I use to map 1 with A, 2 with B etc. ?
Thanks !
click
listener to yourli
s , call a method and in the method , if the id has a class , give an alert statement