Javascript examples for jQuery Method and Property:unbind
Remove event by event function
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ var x = 0;/* w w w . j av a 2 s .c o m*/ $("p").click(function(event){ $("p").animate({fontSize: "+=5px"}); x++; if (x >= 2) { $(this).unbind(event); } }); }); </script> </head> <body> <p style="font-size:20px;">Click to increase its size. The size can only be increased 2 times.</p> </body> </html>