<html>
<head>
<style>
.container{
    width:200px;
    height:200px;
    border:1px solid blue;
}

span{
    display:block;
    width:100px;
    height:100px;
    border:1px solid red;
}
</style>
<script src="jquery.js"></script>
</head>
<body>
<div class="container">
</div>
<div class="test"></div>
</body>
</html>
<script>
$(function(){
    $('.container').on('click',function(){
        var str = '<span class="edit-icon"></span>';
        $(this).next().append(str);
    });

    $(document).on('click','.edit-icon',function(){
        alert('hello world!');
    });
})
</script>

解决方案如上图代码,改为$(document)对象,并修改相应参数。