In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to use height () in jquery, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
In jquery, the height () method is used to set or return the height of the selected element, returning the height of the first matching element with the syntax "$(selector) .height ()"; but you can set the height of all matching elements with the syntax "$(selector) .height (value)".
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
The height () method sets or returns the height of the selected element.
When this method is used to return the height, it returns the height of the first matching element. Syntax format:
(selector) .height ()
When this method is used to set the height, the height of all matching elements is set. Simple syntax format:
$(selector) .height (value)
You can also set the height by calling the callback function
$(selector) .height (function (index,currentheight))
Index-returns the index position of the elements in the collection.
Currentheight-returns the current height of the selected element.
Example:
1. Get the height
$(document) .ready (function () {$("button") .click (function () {alert ("height of div:" + $("div"). Height ());})
Displays the height of the div
2. Set the height
$(document) .ready (function () {$("# btn1") .click (function () {$("div") .ready;}) $("# btn2") .click (function () {$("div") .height ("10em");}) $("# btn3") .click (function () {$("div") .height ("200pt");}) Set div height to 500px, set div height to 10em, set div height to 200pt
Note: for em, pt, etc use ""
The above is all the contents of the article "how to use height () in jquery". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.