How do I get the clicked element with inline HTML onclick and jQuery?
I'm creating a tags with this code: $('#td' + id).append('<p><a href="#" onclick="excluirArquivo(\'' + response + '\'); return false;"><img src="/erp/proposta/media/images/delete.png" alt="Excluir arquivo" /></a> ' + file + '</p>'); excluirArquivo function function excluirArquivo(arquivo) { $.ajax({ type: 'POST', url: '/erp/proposta/index.php/arquivo/remover/' + arquivo }); alert($(this)); } But this element inside excluirArquivo function is returning the Window object. How do I get the clicked element (a tag) inside of excluirArquivo? If you must assign your event handler that way (that is,