我可以使用一些 jquery 来在一行中更改 css 属性,更像
$("#box").css("height":"40px",
"width":"40px"
);
而不是像这样的 2 行代码?
$("#box").css("height","40px");
$("#box").css("width","40px");
最佳答案
$('#box').css({
"height": "40px",
"width": "40px"
});
或者你可以尝试
$("#box").css("height","40px").css("width","40px");
关于javascript - 想要在一行 jquery 代码中更改 css 的 2 个或多个属性,我该怎么做?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41362987/