Reputation: 4733
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.
Upvotes: 0
Views: 1108
Reputation: 119837
one question is: are you doing this script externally or within the page? by your example, i think you are on the page. try changing to this
var ancHref = 'mailto:[email protected]?subject=Blank filter <%=QWebUtility.GetAppSettings().GetSetting("CompanyName") %>';
try this method of creating an element also:
var ancHref = 'mailto:[email protected]?subject=Blank filter <%=QWebUtility.GetAppSettings().GetSetting("CompanyName") %>';
var mylink = $(document.createElement('a'));
mylink.attr('href',anchref);
$("#divMessageBody").append(mylink);
Upvotes: 1
Reputation: 326
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 "
Upvotes: 2