Javascript 带有动态构建主题的mailto HTML电子邮件链接

Javascript 带有动态构建主题的mailto HTML电子邮件链接,javascript,jquery,html,email,Javascript,Jquery,Html,Email,Hi需要动态构建一个主题。也就是说,我有一个输入,其中包含一些我想添加到主题中的数据 例如,如果我只是构建html,我可以编写以下内容: <span style="color: #434343; font-family: 'Segoe UI REGULAR'; font-size: 12pt;"> <text id="supportDescription">Id is '[context.eventId]' .</text> </span>

Hi需要动态构建一个主题。也就是说,我有一个输入,其中包含一些我想添加到主题中的数据

例如,如果我只是构建html,我可以编写以下内容:

<span style="color: #434343; font-family: 'Segoe UI REGULAR'; font-size: 12pt;">
   <text id="supportDescription">Id is '[context.eventId]' .</text>
 </span>

变电站在这里也能工作吗。主题将是evetId 345的回复,当输入值更改时,可以使用jQuery事件处理程序将输入中输入的任何文本放入链接

$('input#eventid'). on('change', function() {
    var link = "mailto:name@gmail.com?subject=The%20reply%20for%20evetId%20" + $(this). val();
    $('a#mailto').attr('href', link);
});

你为什么不试试呢?
$('input#eventid'). on('change', function() {
    var link = "mailto:name@gmail.com?subject=The%20reply%20for%20evetId%20" + $(this). val();
    $('a#mailto').attr('href', link);
});