I have this small problem
<ul>
<li><span id="test">val1</span></li>
<li><span id="test">val2</span></li>
<li><span id="test">val3</span></li>
</ul>
But when I try to get the value of the clicked span I get the value of the first one only (when I click the second or third span I can't get the value of it ) I don't know why this is happening.
Here's the jquery code :
$(document).ready(function(){
$("#test").click(function(){
val = $(this).text();
alert(val);
});
});