In this article of Jquery we will learn about Css so Let's start.
@{
ViewBag.Title = "Css";
}
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="~/js/CssClasses.js" type="text/javascript"></script>
<style>
.important{
font-weight :bold;
font-size:xx-large;
}
.blue{
color:blue;
}
.grey{
color:grey;
}
</style>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<p>This is para</p>
<p>This some more para</p>
<div>This is important blue</div>
<button>Enter</button>
<br /><br /><br /><br />
<p id="hello">Hello</p>
<button id="btn">Enter</button>
<script>
$(document).ready(function () {
$("button").click(function () {
$("h1 , h2 , p").addClass("blue");
$("div").addClass("important");
});
$("#btn").click(function () {
$("#hello").toggleClass("grey");
});
});
</script>
</body>
</html>
Comments
Post a Comment