MailTo From Javascript

前端 未结 2 1813
感情败类
感情败类 2021-02-19 08:28

I\'ve got a link button which is used to build up a mailto from the contents of the page. What is the best way to launch it from javascript without opening a blank window or dis

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-19 09:10

    If you're using jQuery, then you can easily create an element based on the markup you build (refer to this answer for an example) and then invoke the link's click event by simply doing this:

    element.click();
    

提交回复
热议问题