在我的代码中,当div
我单击. 它发生了一次,但它不会工作第二次。由于需要对移动的进行更改,我需要使用两个单独的。我想这与部分有关。你能看到它是如何工作的吗?container_two
container
span
Add New
<div>s
div
parent
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Home</title>
<script type="text/javascript" src="http://localhost/site/scripts/jQueryCore.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.add').click(function() {
var $move = $('#container_two .move');
$(this).parent("div").after($move);
$(".move").show();
});
});
</script>
</head>
<body>
<div id="container">
<div class="h1" data-id="1">Heading One<span class="add" data-id="US01">Add New</span></div>
<div class="h2" data-id="2">Sub One <span class="add" data-id="US02">Add New</span></div>
<br>
<div class="h1" data-id="8">Head Two <span class="add" data-id="US10">Add New</span></div>
<div class="h2" data-id="9">Sub Two <span class="add" data-id="US20">Add New</span></div>
</div>
<div id="container_two">
<div class="move" style="display:none">Mock Form</div>
</div>
</body>
</html>