How to change the href for a hyperlink using jQuery

前端 未结 12 2122
孤街浪徒
孤街浪徒 2020-11-21 11:15

How can you change the href for a hyperlink using jQuery?

12条回答
  •  野性不改
    2020-11-21 11:57

    Use the attr method on your lookup. You can switch out any attribute with a new value.

    $("a.mylink").attr("href", "http://cupcream.com");
    

提交回复
热议问题