In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the use of html () method, which is very detailed and has certain reference value. Friends who are interested must finish it!
.html ()
Description: gets the HTML content of the first matching element in the collection
This method does not accept any elements.
Gets the HTML content of the first matching element in the collection
In an HTML document, we can use the .html () method to get the contents of any element. If the selector matches more than one element, only the HTML content of the first matching element will be fetched. Consider the following code:
$('div.demo-container') .html ()
The content obtained below must be obtained in the div of the first class= "demo-container" in the document:
Demonstration Box
The results are as follows:
Demonstration Box
This method uses the browser's innerHTML property. The result returned by some browsers may not be the HTML source code of the original document. For example, if the attribute value contains only alphanumeric characters, Internet Explorer sometimes discards the quotation marks of the package property value.
Example:
Click on the paragraph to convert HTML to text
P {margin:8px; font-size:20px; color:blue
Cursor:pointer;}
B {text-decoration:underline;}
Button {cursor:pointer;}
Click to change the html
To a text node.
This button does nothing.
$("p") .click (function () {
Var htmlStr = $(this) .html ()
$(this) .text (htmlStr)
})
The above is all the content of the article "what is the use of the html () method?" Thank you for reading! Hope to share the content to help you, more related 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.