我希望用 jQuery 将许多元素 (figcaption) 的尺寸改变为 img 尺寸,请帮助我。
var width = $("div[caption='true'] img").attr("width");
var height = $("div[caption='true'] img").attr("height");
$("div[caption='true'] figcaption").css("width",width);
$("div[caption='true'] figcaption").css("height",height);
$(this)
对象。这是一种代码优化的方法,但不完全必要。在这里阅读更多信息:https://dev59.com/60rSa4cB1Zd3GeqPYrVR - Turnip