替换节点包括以下:
代码如下:
1 <%@ page language="java" import="java.util.*" 2 pageEncoding="utf-8"%> 3 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 4 <html> 5 <head> 6 <title>11</title> 7 <style type="text/css"> 8 .one {width:30%;height:20%;background:#ff00ff;} 9 </style> 10 <script type="text/javascript" src="../js/jquery-1.11.0.js"> 11 </script> 12 <script language="javascript"> 13 $(document).ready(function() 14 { 15 //***********************给ul中添加一个li节点******* 16 17 $("#bt1").click( 18 function() 19 { 20 //**********替换li为strong****************** 21 // $(‘li‘).replaceWith("<strong>hhaha</strong>"); 22 $("<b>Paragraph. </b>").replaceAll("li"); 23 }); 24 }); 25 </script> 26 </head> 27 <body> 28 <input type="button" id="bt1" value="替换li为strong" ></input> 29 <ul id="select"> 30 <li id="li1">选择1</li> 31 <li id="li2">选择2</li> 32 <li id="li3">选择3</li> 33 <li id="li4">选择4</li> 34 <li id="li5">选择5</li> 35 </ul> 36 <br> 37 </body> 38 </html>