源代碼
點擊運行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("#hide").click(function(){ $("p").hide(); }); $("#show").click(function(){ $("p").show(); }); }); </script> </head> <body> <p>如果你點擊“隱藏” 按鈕,我將會消失。</p> <button id="hide">隱藏</button> <button id="show">顯示</button> </body> </html>
運行結果