Jquery小效果

mac2022-06-30  25

jQuery

Some text Some other text   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>jQuery</title> <style type="text/css"> </style> <script src="jquery.js" type="text/javascript"></script> <script type="text/javascript"> $(function(){ $("div.firstBox").hover(function(){ $(this).text(" Text changed!"); }, function(){ $("div.secondBox ").append($(this)); } ) }) </script> </head> <body> <div class="firstBox">Some text</div> <div class="secondBox ">Some other text</div> </body> </html>

不运行,能猜到效果是怎样的吗.?

很有意思的是$(this)为firstBox作为整个对象直接append到secondBox后面.

转载于:https://www.cnblogs.com/-gap/archive/2012/05/08/2490273.html

最新回复(0)