Here is the jsfiddle for what I was testing http://jsfiddle.net/5hhRF/
there is number 1 2 1 2.... when u click last digit which is "2" it don't alert.
Was I missing some code for that case?
I am copying the same code here again.
<span class="open-option" id="option1" >1</span>
<span class="open-option" id="option2" >2</span>
<span id="open-option" class="option1" >1</span>
<span id="open-option" class="option2" >2</span>
$(".open-option").click(function(){ var myID=$(this).attr('id'); alert(myID); }); $("#open-option").click(function(){ var myClass=$(this).attr('class'); alert(myClass); });