You have to get a reference for the input element. Then, just call
reference.attr('id');
If it had a class, for example, inputClass, you could do:
var reference = $(".inputClass");
Here's how I would approach your particular situation. You have:
<input id='edit1' type='button' value='Edit' onclick=edit(this.id) />
<input id='edit2' type='button' value='Edit' onclick=edit(this.id) />
<input id='edit3' type='button' value='Edit' onclick=edit(this.id) />
I would replace this for:
<input id='edit1' type='button' value='Edit' class='inputClass'/>
<input id='edit2' type='button' value='Edit' class='inputClass'/>
<input id='edit3' type='button' value='Edit' class='inputClass'/>
Then, anywhere in your page, you write this piece of code:
$(document).ready(function() {
$('.inputClass').each(function() {
$(this).click(function(){
var id = $(this).attr('id');
//Do whatever the edit function should do with the id
});
});
});
this binds a function for each of the elements which call your edit function...