//show $("#btn1").click(function () { $("#showBlock").show(); }); //hide $("#btn2").click(function () { $("#showBlock").hide(); }); //transfer element show and hide $("#btn3").click(function () { $("#showBlock").toggle(); });
<body> <!-- show element --> <input type="button" id="btn1" value="showBtn"/> <!-- hide element --> <input type="button" id="btn2" value="hideBtn"/> <!-- transfer element show and hide --> <input type="button" id="btn3" value="switchBtn"/> <!-- Block --> <div id="showBlock" style="display:none;"> hi </div> </body>