运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script> function changeSize() { $(this).animate({fontSize: "+=3px"}); } function changeSpacing() { $(this).animate({letterSpacing: "+=2px"}); } $(document).ready(function(){ $("body").on("click", "p", changeSize); $("body").on("click", "p", changeSpacing); $("button").click(function(){ $("body").off("click", "p"); }); }); </script> </head> <body> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <p>Click any p element to increase size and letterspacing.</p> <button>Remove all click event handlers</button> </body> </html>