So, in short, I have a set of .li
<ul>
<li class="lmit_1"><a href="#" >Home</a></li>
<li class="lmit_2"><a href="#">About us</a></li>
<li class="lmit_3"><a href="#">Who we are</a></li>
<li class="lmit_4"><a href="#">Whats new</a></li>
<li class="lmit_5"><a href="#">Contact Us</a></li>
</ul>
and my javascript (jQuery)
<script>
$(".lmit_" + id).click(function () {
alert(id);
});
</script>
What I am trying to do is receive whatever number is at the end of the css class as a parameter (.lmit_3 for example would allow id = 3) and therefore alert(id) should lead to a popup with the number 3? I am new to both programming and javascript so my apologies if the answer is staring me in the face...
lmit_n
anid
? There's little use to having unique classes. – Blender Sep 6 '12 at 3:53