Pass the value of idx as second parameter to the function
Not sure about PHP syntax
<?php
for($i = 0; $i < 20; $i++) {
$idx = $i;
?>
<input class="edit-btn" type="button" name="edit" value="" onClick="editMe(this, <?php echo $idx; ?>)"/>
<?php } ?>
then
function editMe(el, idx){
}
3
solved Which button was clicked among a same class of buttons [duplicate]