[JQ权威指南]第八天:删除页面元素

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="../jquery-2.1.4.js"></script>
<style type="text/css"> body{ font-size:13px;} ul{ width:200px;} ul li{ list-style:none; padding:0px; height:23px;} span{ padding-left:20px;} .btn { border:#666 1px solid; padding:2px; width:60px;} </style>
<script type="text/javascript" > $(function(){ $("ul li:first").css("font-weight","bold"); $("#Button1").click(function(){ $("ul li").remove("li[title=t]"); $("ul li:eq(1)").remove(); }) }) </script>
</head>
<body>
<ul>
    <li>学号</li>
    <li title="t">1001</li>
    <li>1002</li>
    <li>1003</li>

    <li style="text-align:center; padding:5px">
        <input id="Button1" type="button" value="删除" class="btn" />
    </li>
</ul>
</body>
</html>

你可能感兴趣的:([JQ权威指南]第八天:删除页面元素)