2025年02月18日 建站教程
jquery如何给img新增一个a标签,下面web建站小编给大家详细介绍一下!
利用wrap()函数实现代码
$(document).ready(function() { $("button").click(function() { $("img").wrap("<a href='#'></a>"); }); });
输出结果:
<a href='#'><img src="/staticimg/pic.jpg" width="200"/></a>
本文链接:http://so.lmcjl.com/news/23406/