标签:return png 参考 his man nbsp this function color
wrap是包裹元素的作用,比如我想在img外面包裹一个a标签时,可以这样写法:
$(function(){ $(‘img‘).wrap(function(){ return ‘<a href="‘ + this.src + ‘" title="点击查看原图" target="_blank"></a>‘; }) });
此时在前端渲染出来的HTML如下所示:
<a href="http://images2015.cnblogs.com/blog/417876/201707/417876-20170712170222118-748566468.png" title="点击查看原图" target="_blank">
<img src="http://images2015.cnblogs.com/blog/417876/201707/417876-20170712170222118-748566468.png" alt="">
</a>
参考:
http://www.w3school.com.cn/jquery/manipulation_wrap.asp
标签:return png 参考 his man nbsp this function color
原文地址:http://www.cnblogs.com/EasonJim/p/7158486.html