我在网址上的变量 productsList 的链接中未定义任何可能出现问题的想法?
当我将鼠标悬停在链接上时,它会正确显示字符串,但点击后会将其变为未定义
我的代码:
$(".emailCustomer").click(function(urlEmail){
var invoiceNumber = $(this).closest("li").find(".invoiceNumber").text();
// active subject invoice no.
var emailAddress = $(this).data("email");
var customerName = $(this).data("customer");
var productsList = $(this).data("products");
urlEmail = "https://mail.google.com/mail/?view=cm&fs=1&to="+emailAddress+"&su=+invoiceNumber+&body="+customerName+"%2C%0A%0A"+productsList+"%0A%0AEMAIL+SIGNATURE";
$(this).attr("href" , urlEmail);
$(this).attr("target" , "_blank");
return urlEmail;
});
<a class="emailCustomer" href="https://mail.google.com/mail/?view=cm&fs=1&to="+emailAddress+"&su=+invoiceNumber+&body="+customerName+"%2C%0A%0A"+productsList+"%0A%0AEmail+Signature" data-email="{{i.email}}" data-customer="{{i.name}}" data-products="{{i.products}}" target="_blank">
答案 0 :(得分:0)
在您的标记上未设置属性ModelMetadata
,因此在您的点击回调中DisplayAttribute
未定义。