inline javascript in href

后端 未结 4 1389
猫巷女王i
猫巷女王i 2021-02-05 11:03

How can you do something like this:

myLink

And have the js

4条回答
  •  星月不相逢
    2021-02-05 11:15

    I know this question is old but I had a similar challenge dynamically modifying the href attribute that sends an email when the anchor tag is clicked.

    The solution I came up with is this:

    $('#mailLink,#loginMailLink,#sbMailLink').click(function () {
        this.setAttribute('href', "mailto:" + sessionStorage.administrator_mail_address + "?subject=CACS GNS Portal - Comments or Request For Access&body=Hi");
    });
    CACS GNS Site Admin.

    I hope that helps.

提交回复
热议问题