html 页面追加文本之后触发不了定义的方法

$(function(){
    //在页面追加文本信息
    $(".create").click(function(){
        $('.time').before('<tr><td class="narrow-label"></td><td><input type="file" name="content[]" size ="40" maxlength="60" value="" />  <a href="javascript:;" title="关闭" class="delete">[ - ]</a></td> </tr>');
        //追加之后再追加方法里给追加的文本添加事件,如果写在追加方法外面就触发不了,原因应该是页面已经加载完了,没有检测到页面上有该文本
        $('.delete').click(function(){
            $(this).parent().parent().remove();
        })
    })
})
posted @ 2016-06-20 16:21  wendou  阅读(180)  评论(0编辑  收藏  举报