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(){ $('#box').css('color','red');//为id为box的p加入行间样式 }); </script> </head> <body> <p id="box">Jquery</p> </body> </html>
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!