Write a jQuery code to create a zebra stripes table effect.
Answer :
File Name : jQuery7.html
<html>
<head>
<script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>
<title>SP Creation</title>
</head>
<body>
<style type="text/css">
.zebra{
background-color: #ff0066;
}
</style>
<title>Create a Zebra Stripes table effect</title>
</head>
<body>
<div class="table">
<table>
<tr>
<th>Student Name</th>
<th>Marks in Science</th>
</tr>
<tr>
<td>PRIYA</td>
<td>85.00</td>
</tr>
<tr>
<td>SANIKA</td>
<td>92.00</td>
</tr>
<tr>
<td>SHITAL</td>
<td>87.00</td>
</tr>
<tr>
<td>SWARA</td>
<td>80.00</td>
</tr>
</table>
</div>
<script>
$(document).ready(function(){
$("tr:odd").addClass("zebra");
});
</script>
</body>
</html>
Write a jQuery code to create a zebra stripes table effect.
Reviewed by technical_saurabh
on
April 30, 2021
Rating:
No comments:
Post a Comment