解决方法
Here’s a working fiddle.
JS:
$(function(){ $(document).click(function(e){ var x = e.pageX + 'px'; var y = e.pageY + 'px'; var img = $('<img src="" alt="myimage" />'); var div = $('<div>').css({ "position": "absolute","left": x,"top": y }); div.append(img); $(document.body).append(div); }); });