<script>
function clica(){
var x = document.getElementById("clica").value;
alert(x);
}
</script>
<?php
for ($i=0;$i<10; $i++){
?>
button onclick='clica()' id='clica' value='<?php echo $i;?>'><?php echo $i;?></button>
<?php
}
?>
I have this code and would like it every time you click a button, display its numeric value. But only the first value is displayed, and if I put the function inside the for, it only displays the last one. How do I get the value right?