Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> <script src="http://cdn.static.w3big.com/libs/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("div").contents().filter("em").wrap("<b/>"); }); }); </script> </head> <body> <div><em>Hello world! What a beautiful day!</em></div> <p>在这个实例中,通过点击按钮,我们查找到所有div元素内得文本节点,并且使用b元素包裹它们。</p> <button>查找所有文本节点并且包裹它们</button><br> </body> </html>