javascript和jquery修改a标签的href属性【转】

javascript:

document.getElementById("myId").setAttribute("href","www.xxx.com");  
document.getElementById("myId").href = "www.xxx.com";  

jquery:

$("#myId").attr("href","www.xxx.com");

文章转自:https://www.jb51.net/article/44501.htm

posted @ 2020-06-17 18:31  小猿笔记  阅读(1083)  评论(0编辑  收藏  举报