代码
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="js/jquery.js"></script>
</head>
<body>
<p>1</p>
<p id="two">2</p>
<p class="three">3</p>
<script>
$(function(){
$("body p:first-child").on("click",function(){
$(this).css("color", "red");
});
$("#two").on("click",function(){
$(this).css("color", "red");
});
$(".three").on("click",function(){
$(this).css("color", "red");
});
});
</script>
</body>
</html>
效果