版权声明:本文为大都督作者的原创文章,未经 大都督 允许也可以转载,但请注明出处,谢谢! 共勉! https://blog.csdn.net/qq_37335220/article/details/85038556
1.效果图
2. html代码
<!DOCTYPE html>
<html>
<head>
<title>3.12 使用appendTo()方法插入节点</title>
<style type="text/css">
body{font-size:13px}
img{border: solid 1px #ccc;padding: 3px;margin: 5px;}
</style>
</head>
<body>
<img alt="奔跑中的小猪" src="../img/pig.jpg" width="70px" height="70px">
<span></span>
<script src="../jquery.min.js"></script>
<script type="text/javascript">
$(function(){
//插入内容
$("img").appendTo($("span"));
});
</script>
</body>
</html>