javascript和jquery修改a标签的href属性_jquery
时间:2021-07-01 10:21:17
帮助过:10人阅读
javascript:
代码如下:
document.getElementById("myId").setAttribute("href","www.xxx.com");
document.getElementById("myId").href = "www.xxx.com";
jquery:
代码如下:
$("#myId").attr("href","www.xxx.com");