Skip to content

Commit f4fe6e0

Browse files
committed
jquery css() | removeAttr() method ❄
1 parent 5fc78b3 commit f4fe6e0

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

jQuery/css/cssMethod.html

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
6+
<script>
7+
$(document).ready(function () {
8+
$("#setCssBtn").click(function () {
9+
$("p").css({ "background-color": "#ace60e", "font-size": "210%" });
10+
});
11+
12+
$("#removeStylesBtn").click(function () {
13+
$("p").removeAttr("style");
14+
});
15+
});
16+
</script>
17+
</head>
18+
19+
<body>
20+
21+
<h2>This is a heading</h2>
22+
23+
<p style="background-color:#ff0000">This is a paragraph 1.</p>
24+
<p style="background-color:#00ff00">This is a paragraph 2.</p>
25+
<p style="background-color:#0000ff">This is a paragraph 3.</p>
26+
27+
<p>This is a paragraph 4.</p>
28+
29+
<button id="setCssBtn">Set multiple styles for p</button>
30+
<button id="removeStylesBtn">Remove multiple styles</button>
31+
32+
</body>
33+
34+
</html>

0 commit comments

Comments
 (0)