我正在使用它在新窗口中打开传出链接,但是当目标是图像时,我想将图像 alt 显示为标题。
$("a[href*='http://']:not([href*='"+location.hostname+"']),
[href*='https://']:not([href*='"+location.hostname+"'])")
.addClass("external")
.attr("target","_blank")
.attr("title", "Open link in new window");
});
将其添加到 .attr("title") 的最简单方法是什么?