Passando $(this) para função - forma 2
by Tiago Agostinho
HTML
<table>
<tr>
<td><input type="text" name="campo1" data-id="1"></td>
<td><input type="text" name="campo2" data-id="2"></td>
<td><input type="text" name="campo3" data-id="3"></td>
</tr>
</table>
<p id="resultado"></p>
JavaScript
// não precisa passar $(this) como parâmetro da função
$("table").on("keypress", "input", nome_funcao);
function nome_funcao(){
// imprime resultado
$("#resultado").html( "Input - ID: "+ $(this).data("id") );
}