<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div>
<div>
<div style="display: inline-block">
<a onclick="Add(this);"><button>+</button></a>
</div>
<div style="display: inline-block">
<input type="checkbox">
<input type="text" value="IP">
</div>
</div>
</div>
<script src="../../jquery-1.12.4.js"></script>
<script>
function Add(self) {
$(self).parentsUntil("outer").clone().find("a").html("<button>-</button>").attr("onclick","Remove(this);").end().eq(1).appendTo(".outer");
}
function Remove(self) {
$(self).parentsUntil("outer").eq(1).remove();
}
</script>
</body>
</html>
常言道:“鼓要敲在点子上,蛇要打在七寸处”,讲的就是为人话不在多,而在于关键时刻能因地制宜地讲出关键的话来,从而起到四两拔千斤的作用。