js添加、删除元素操作

js添加、删除元素操作

<i class="layui-icon layui-icon-close" onclick="delElem(this)"></i>
<script>
   function addElement(){//添加子评分项
       console.log("addPrivateEvaluate");
       $("#addPrivateEvaluateChild").append("
       <i class='layui-icon layui-icon-close' onclick='delElem(this)'></i>"
       ).clone(true);
   }
   function delElem(obj){
       console.log("del");
       var delElem = obj.parentNode;
       delElem.remove();
   }
</script>

你可能感兴趣的:(js,js,html,前端)