JavaScript在div后添加删除div

时间:2019-02-26 16:16:01   收藏:0   阅读:183
 var idd = ‘str‘;
        $(‘.task-done-detail-content-p7‘).click(function () {
            var id = this.id;
            if(idd !== id){
                $(‘.do-task2‘).remove();
                //选中的div后添加div
                $(this).after("<div class=‘do-task2‘ ><p class=‘do-task-p2‘>修改任务</p><p class=‘do-task-p2‘>删除任务</p></div>");
                idd = id;
            }else{
                //去除添加div
                $(‘.do-task2‘).remove();
                idd = ‘str‘
            }
        });

 

原文:https://www.cnblogs.com/wanlibingfeng/p/10437978.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!