jQuery event.namespace custom value
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script>/*w ww .jav a2 s. c o m*/ <script> $(document).ready(function(){ $("p").on("click.myId", function(){ $(this).slideToggle(); }); $("button").click(function(){ $("p").off("click.myId"); }); }); </script> </head> <body> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <p>Click any p element to make it disappear.</p> <button>Remove the click.myId namespace for all p elements</button> <br><br> </body> </html>