Lets assume we have the following code:
<a class="addproduct 151">product info</a>
<a class="addproduct 151">product info</a>
<a class="addproduct 151">product info</a>
<a class="addproduct 151">product info</a>
<a class="addproduct 151">product info</a>
I want to be able to count how many of the same class is in the page. Then upon clicking a specific one, it tells me which one it is... so... if I click the 3rd one down it will print a "3" to the console.
I've got this code so far:
$("addproduct 151").each(function(index) {
$(this).addClass('number' + index);
});