嗨,我正在尝试向<a>
标签添加 href,这样当用户单击图像时,它会打开一封电子邮件。
标签文本更新得很好,但锚点 href 似乎不适用于 jquery 以将所述 href 添加到标签
这是asp:
<a class="hrefEditMailTo"><img src="Images/MailTo24x20.png" class="imgEditMailTo darkenOnHover" alt="Click to email me" /></a>
<asp:Label ID="lblIDMailToImage" CssClass="lblMailToImage" runat="server"></asp:Label>
这是jQuery:
//Dynamically change the labels text next to the email icon on the popup.
var imgLabelText = "Send an email to requester/contact (" + strRequestersemail +")"
if (strRequestersemail == "") {
imgLabelText = "Send email to a contact"
$('.hrefEditMailTo').prop('href', "mailto:" + strRequestersemail + "?Subject=There%20has%20been%20a%20comment%20added%20to%20your%20order%20" + strPWNum + "");
};
$("#<%=lblIDMailToImage.ClientID%>").text(imgLabelText);