<script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js">
$(document).ready(function(){
$("p.test1").on("click",function(){
$(this).css("background-color","pink");
$("#btn1").click(function(){
$("p.test2").live("click",function(){
$(this).css("background-color","yellow");
$("#btn2").click(function(){
<h4 style="color:green;">This example demonstrates how to achieve the same effect using off() and die().</h4>
<p class="test1">Click this paragraph to change its background color.</p>
<p class="test1">Click the button below and then click on this paragraph (the click event is removed).</p>
<button id="btn1">Remove the click event with off()</button>
<p class="test2">Click this paragraph to change its background color.</p>
<p class="test2">Click the button below and then click on this paragraph (the click event is removed).</p>
<button id="btn2">Remove the click event with die()</button>