Home >Web Front-end >JS Tutorial >jQuery uses height() to obtain the height that needs attention_jquery

jQuery uses height() to obtain the height that needs attention_jquery

WBOY
WBOYOriginal
2016-05-16 16:27:351589browse

The example of this article analyzes what needs to be paid attention to when jQuery uses height() to obtain height. Share it with everyone for your reference. The specific analysis is as follows:

The jQuery script is as follows:

Copy code The code is as follows:
var aNode = $('#demo');
var height = aNode.height(); //If aNode is already display:none before getting the height or aNode is hidden, then the height of aNode cannot be obtained
console.log(height);

The HTML page is as follows:

Copy code The code is as follows:

I hope this article will be helpful to everyone’s jQuery programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn