<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www./TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www./1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>元素的替换</title> <script type="text/javascript" src="jquery-1.7.2.js"></script> <script type="text/javascript"> $(function(){ $('p').click(function(){ //$('p').replaceWith('<h4>我是被替换的</h4>') $('<h4>我是被替换的</h4>').replaceAll('p')
}) }) </script> </head> <p>这是一个p元素</p>
<body> </body> </html>
|