$(function() { $('.btn').click(function(e) { var x = e.pageX - $(this).offset().left; var y = e.pageY - $(this).offset().top; $(this).find('i').remove(); $(this).append('') }) })