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> <title></title> <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $("#replace").click(function () { $("br").replaceWith("<hr/>"); //将所有br替换为hr $("p").wrap("<font color='red'></font>"); //用红色样式将p标签给包起来 //<font color='red'> <p> 用特定的样式包起来</p></font> }); }) </script> </head> <body> sdfsdfsdfrgrefg<br /> sdfsdfsdfrgrefg<br /> sdfsdfsdfrgrefg<br /> sdfsdfsdfrgrefg<br /> sdfsdfsdfrgrefg<br /> sdfsdfsdfrgrefg<br /> <p> 用特定的样式包起来</p> <p> 用特定的样式包起来</p> <p> 用特定的样式包起来</p> <p> 用特定的样式包起来</p> <input type="button" value="ReplaceWith" id="replace" /> </body> </html>