In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 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 add class in jquery. I hope you will get something after reading this article. Let's discuss it together.
Jquery to add class methods: 1, the use of "$(specified element)" statement to get the specified element object; 2, the use of addClass () method to add class to the specified element, the syntax is "element object .addClass (" new class ");".
The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.
Jquery provides a method for addClass () to add the class class, which allows you to add the class class to the tag. Make the font larger by clicking the button to add the lass class to demonstrate the addClass () method.
The addClass () method adds one or more classes to the selected element.
This method does not remove the existing class attribute, but simply adds one or more class attributes.
Examples are as follows:
$(document) .ready (function () {$("button") .click (function () {$("p:first"). AddClass ("intro");});}); .intro {font-size: 40px;} This is a heading
This is a paragraph.
This is another paragraph.
Add a class to the first p element
Output result:
After reading this article, I believe you have a certain understanding of "how to add class in jquery". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
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.