In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you the relevant knowledge points about how to use HasClass (className). The content is detailed and the logic is clear. I believe most people still know too much about it, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
.hasClass (className)
Description: determines whether any matching element has a given (style) class assigned.
Added version: 1.2.hasClass (className)
ClassName
Type: String
The name of the style to query.
The element may have a style name of. In HTML, use spaces to separate multiple styles:
If there is a specified style on the matching element, the .hasClass () method returns true, even though there may be other styles on the element. For example, adding the following code to the HTML above returns true:
$('# mydiv'). HasClass ('foo')
You can also:
$('# mydiv'). HasClass ('bar')
However, this returns false:
$('# mydiv'). HasClass ('quux')
Example:
Look for the 'selected' style on the matching elements.
P {margin: 8px; font-size:16px;}
.selected {color:red;}
This paragraph is black and is the first paragraph.
This paragraph is red and is the second paragraph.
First paragraph has selected class:
Second paragraph has selected class:
At least one paragraph has selected class:
$("div#result1") .append ($("p:first") .hasClass ("selected") .toString ()
$("div#result2") .append ($("p:last") .hasClass ("selected") .toString ()
("div#result3") .append ($("p") .hasClass ("selected") .toString ()
These are all the contents of the article "how to use .hasClass (className)". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to 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.