Adding CSS Class to the Last Selected Paragraph Element and Highlight.

vishalneeraj-24503
Posted by vishalneeraj-24503 under jQuery category on | Points: 40 | Views : 260
<!doctype html>
<html lang = "en">
<head>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<meta charset="utf-8">
<style>
p
{
margin: 8px;
font-size: 16px;
}

.selected
{
color: red;
}

.highlight
{
background: yellow;
}
</style>
</head>

<body>
<p>vishal</p>
<p>kumar</p>
<p>neeraj</p>
<script>
$("p:last").addClass("selected highlight");
</script>
</body>
</html>

Comments or Responses

Login to post response