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:abc@abc.com "?"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.
Yours variable is wrong:
var ancHref = "mailto:abc@abc.com?subject=Blank filter"+'<%=QWebUtility.GetAppSettings().GetSetting("CompanyName") %>';
$("#divMessageBody").append("<a href=" + ancHref + "/>");
You typed too much "
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:abc@abc.com?subject=Blank filter <%=QWebUtility.GetAppSettings().GetSetting("CompanyName") %>';
try this method of creating an element also:
var ancHref = 'mailto:abc@abc.com?subject=Blank filter <%=QWebUtility.GetAppSettings().GetSetting("CompanyName") %>';
var mylink = $(document.createElement('a'));
mylink.attr('href',anchref);
$("#divMessageBody").append(mylink);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.