扫码关注官方订阅号
$("#id").append('');
就像这样添加一个img标签,但是为什么添加进去是没有封闭的呢?在HTML里是这样的
走同样的路,发现不同的人生
img属于自动封闭标签
另外你那个js代码可以正常运行? 不应该是
$("#id").append("<img src='src'>");
http://api.jquery.com/jQuery/...
When the parameter has a single tag (with optional closing tag or quick-closing) — $( "<img />" ) or $( "<img>" ), $( "<a></a>" ) or $( "<a>" ) — jQuery creates the element using the native JavaScript .createElement() function.
也就是说不是直接插入的
是先解析html->得出是单个的img->使用createElement
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
img属于自动封闭标签
另外你那个js代码可以正常运行? 不应该是
http://api.jquery.com/jQuery/...
也就是说不是直接插入的
是先解析html->得出是单个的img->使用createElement