Home > Web Front-end > JS Tutorial > body text

Example of adding row styles to divs using jQuery

小云云
Release: 2018-01-10 09:55:47
Original
1041 people have browsed it

JQuery all starts with the $ symbol. Of course, you can use jQuery to replace the $ sign. They are identical and equal at the same time. () is actually a method, which can pass anonymous functions, etc. When selecting a certain p, if the id is p1, use $('#p1'). Remember to add the # sign. This is the same as the # sign we add when writing css styles. This article mainly introduces in detail the relevant methods of adding row styles to a certain p using jQuery. It has certain reference value. Interested friends can refer to it. I hope it can help you.

Sample example is as follows:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head> 
  <title>基础核心</title>
 <script type="text/javascript" src="jquery-1.11.1.js"></script>
 <script type="text/javascript">
 $(function(){
 
 $(&#39;#box&#39;).css(&#39;color&#39;,&#39;red&#39;);//为id为box的p加入行间样式
 
});
 </script>
 </head>
 
 <body>
 <p id="box">Jquery</p>
 
 </body>
</html>
Copy after login

Rendering:

Change the font color to Red:

Related recommendations:

jQuery click anywhere except the specified area to hide the DIV function

jQuery implements detailed explanation of swapping positions of buttons in two divs

jQuery loads an html page into the specified div

The above is the detailed content of Example of adding row styles to divs using jQuery. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!