Professional Documents
Culture Documents
Networking 3
Networking 3
REPRESENTING
DIVYAA GORE
ROLL NO-28
SY BBA(CA)
1
Click to edit Master title style
O P I C - H O W T O I N S E RT E L E M E N T S B Y A D D I N G C S S C L A S S
D Y N A M I C A L LY.
2 2
Click to edit
ADDING Master title
CSS ELEMENT style
DYNAMICALLY:
3 3
Click to edit Master title style
Syntax:
$(selector).css(property)
Here we have created two elements inside the body tag i.e. <h1> and <h3>
elements. We apply CSS property on the <body> tag and <h1> tag using
CSS () method dynamically.
4 4
Click to edit Master title style
<!DOCTYpe html>
<html>
<head>
<title>
How to add CSS properties to an element dynamically using jQuery?
</title>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
5 5
Click to edit Master title style
<script>
$(document).ready(function () {
$("body").css("text-align", "center");
$("h1").css("color", "green");
});
</script>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h3>
How to add CSS properties to an element
6 6
Click to edit Master title style
<br>dynamically using jQuery?
</h3>
</body>
</html>
7 7
ClickMANIPULATION:
CSS to edit Master title style
1010
ClickMANIPULATION:
CSS to edit Master title style
1111
ClickMANIPULATION:
CSS to edit Master title style
Example
$("p").css("background-color");
1212
Click to edit Master title style
THANK YOU.
13