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 'Jquery008.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() {
				$("#btn1").click(function() {
					//remove方法会返回被移除的节点的jQuery对象
					//var removedLi = $("ul li:eq(3)").remove();
					//removedLi.appendTo($("ul"));
		
					//empty方法是请控件元素中的内容
					$("ul li:eq(3)").empty();
				});
			});
		</script>
	</head>

	<body>
	    <ul>
	     <li>aaaaaaaaaaaaaaaa</li>
	     <li>bbbbbbbbbbbbbbbb</li>
	     <li>cccccccccccccccc</li>
	     <li>dddddddddddddddd</li>
	     <li>eeeeeeeeeeeeeeee</li>
	     <li>ffffffffffffffff</li>
	    </ul>
	    <input type="button" value="click" id="btn1"/>
	</body>
</html>
 

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