JQuery Set Background
From w3cyberlearnings
Contents |
jQuery Set Background Color
You use the CSS property to set background color.
Syntax
$("p").css('background-color','grey'); $('.kk33').css('background-color','green');
Example TRY-IT
<!DOCTYPE html> <html> <head> <title>Access ID</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="jquery.min.js"> </script> <script> $(document).ready(function(){ $("p").css('background-color','grey'); $('.kk33').css('background-color','green'); }); </script> </head> <body> <p>All of the people are very happy.</p> <p class="k33">Great people like to say great things.</p> <div class="kk33">Nothing can be changed right now!</div> </body> </html>
Related Links
- JQuery Set Font Size
- jQuery Set Background
- jQuery Odd and Even