I need to update href value using jquery

后端 未结 7 520
南笙
南笙 2021-01-15 02:35

I need to update href value thorughout the page using jquery. Say href=\"http://www.google.com?gsec=account\" should be changed to href=\"http://account.google.com?gsec=acco

7条回答
  •  Happy的楠姐
    2021-01-15 02:58

    Use jQuery’s .attr() method. With one parameter, it returns the attribute value, with two parameters you set it.

    $("a#whatever").attr("href", "http://account.google.com?gsec=account");
    

提交回复
热议问题