主要用到 wrap()函数 http://www.w3school.com.cn/jquery/manipulation_wrap.asp

这个函数是创建新的的元素去包裹所执行这个方法的元素

如下例子:

$("img").each(function() {
    var strA = "<a href='http://www.dell-driver.com/driver-updater/'></a>";
    $(this).wrap(strA);
});

 

还有一个wrapAll()方法,功能一样,只是对选中的所有元素都生效而已

http://www.w3school.com.cn/jquery/manipulation_wrapall.asp

相关文章:

  • 2022-12-23
  • 2021-12-03
  • 2021-05-19
  • 2021-12-11
  • 2021-11-12
  • 2021-12-18
  • 2022-12-23
猜你喜欢
  • 2022-01-24
  • 2021-07-10
  • 2022-01-16
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
相关资源
相似解决方案