HTML 练习显示隐藏
程序员文章站
2022-06-19 21:46:42
``` Title hello world ``` ......
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>title</title> <script src="jquery-3.3.1.min.js"></script> </head> <body> <p style="display:none">hello world</p> <input type="button" id="show" value="显示"> <input type="button" id="hide" value="隐藏"> <input type="button" id="toggle" value="toggle"> </body> <script> $("#show").click(function(){ $("p").show() }) $("#hide").click(function(){ $("p").hide() }) $("#toggle").click(function(){ $("p").toggle() }) </script> </html>