Search code examples
javascriptjquerymailto

Mailto link in a message with a subject line not working using javascript


I am trying to set a href of a tag using java script for making that tag open a dialog to send a mail.

var ancHref = "mailto:[email protected] "?"subject=Blank filter"+" "+'<%=QWebUtility.GetAppSettings().GetSetting("CompanyName") %>';
$("#divMessageBody").append("<a href=" + ancHref + "/>");

but something is going wrong can you tell me how to append a subject that could be dynamic in nature that i am doing.


Solution

  • Yours variable is wrong:

    var ancHref = "mailto:[email protected]?subject=Blank filter"+'<%=QWebUtility.GetAppSettings().GetSetting("CompanyName") %>';
    $("#divMessageBody").append("<a href=" + ancHref + "/>");
    

    You typed too much "