gpt4 book ai didi

javascript - 纯javascript相当于jquery赋值

转载 作者:可可西里 更新时间:2023-11-01 13:51:08 25 4
gpt4 key购买 nike

<分区>

我一直在尝试为这个 JQuery 代码的纯 JavaScript 版本找出正确的语法。

$('body').css('margin-bottom', $('footer').height());

到目前为止我所拥有的是:

var body = document.getElementById('#body');
var footer = document.getElementById('#footer');

body.style.marginBottom = footer.style.height;

此分配仅在我在 JavaScript 中定义页脚高度时有效。

我知道这个问题 How to make a pure javascript .css() function using variable variables [duplicate]和类似的问题,但仍然无法正确。我知道我可以只使用 JQuery,但我看不到加载整个库来完成非常简单的事情的值(value)。

提前谢谢你。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com