<script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js">
$(document).ready(function(){
$("body").on("click","p",function(){
$(this).css("background-color","pink");
$("#btn1").click(function(){
$("body").off("click","p");
$("#btn2").click(function(){
$("body").undelegate("p","click");
<h4 style="color:green;">This example demonstrates how to achieve the same effect using off() and undelegate().</h4>
<p>Click this paragraph to change its background color.</p>
<p>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>
<button id="btn2">Remove the click event with undelegate()</button>