ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
【jQuery前后元素移动】 ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <div> <div id="div1">123</div> <div id="div2">456</div> </div> <div> <input type="button" id="btnPrevious" value="向前" /> <input type="button" id="btnAfter" value="向后"/> </div> <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#btnPrevious").bind("click",function(){ $("#div2").prev().before($("#div2")); }); $("#btnAfter").bind("click",function(){ $("#div2").next().after($("#div2")); }); }); </script> </body> </html> ~~~