企业🤖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> ~~~