jQuery 复制元素

<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<title>My JSP 'Jquery009.jsp' starting page</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<script type="text/javascript" src="js/jquery-1.6.1.js"></script>
		<!-- 复制元素 -->
		<script type="text/javascript">
			$(document).ready(function() {
				$("ul li").click(function() {
					//$(this).clone().appendTo($("ul")) //只复制元素,不复制元素的事件
					$(this).clone(true).appendTo($("ul"))// 复制元素及元素的事件
				});
			});
		</script>
	</head>

	<body>
		<ul>
			<li>aaaaaaaaaaaaaaaa</li>
			<li>bbbbbbbbbbbbbbbb</li>
			<li>cccccccccccccccc</li>
			<li>dddddddddddddddd</li>
			<li>eeeeeeeeeeeeeeee</li>
			<li>ffffffffffffffff</li>
		</ul>
	</body>
</html>

你可能感兴趣的:(JavaScript,html,jquery,jsp,cache)