添加 VAR 作为属性名称或描述
Add VAR as attribute name or description
我调用 h4 文本作为复选框上的 aria-label。然而,这不是最好的方法,这是我在这个项目上唯一的选择。我无法将变量插入到 aria-label 中。
var prodname = $(".checkbox").closest("tr").find("td.product-shortdesc h4").text();
console.log(prodname);
$("td.select .checkbox").attr("aria-label", "'' +prodname+ '");
感谢您的帮助
最后一行应该是
$("td.select .checkbox").attr("aria-label", prodname);
我调用 h4 文本作为复选框上的 aria-label。然而,这不是最好的方法,这是我在这个项目上唯一的选择。我无法将变量插入到 aria-label 中。
var prodname = $(".checkbox").closest("tr").find("td.product-shortdesc h4").text();
console.log(prodname);
$("td.select .checkbox").attr("aria-label", "'' +prodname+ '");
感谢您的帮助
最后一行应该是
$("td.select .checkbox").attr("aria-label", prodname);