开发者

How to get div height value in JavaScript or jQuery?

开发者 https://www.devze.com 2023-03-30 21:29 出处:网络
I need to get a div\'s height in JavaScript or jQuery and change it\'s value in CSS. How could I do this in jQuery or JavaScrip开发者_如何学Ct?This should accomplish what you need

I need to get a div's height in JavaScript or jQuery and change it's value in CSS.

How could I do this in jQuery or JavaScrip开发者_如何学Ct?


This should accomplish what you need

var height = $(selector).height();

and you set it like this

$(selector).height(val);


Pretty standard javascript.

var divHeight = document.getElementById("yourDiv").style.height
0

精彩评论

暂无评论...
验证码 换一张
取 消