jQuery ?? - ??? ? ??
hide() ? show()
jQuery??? hide() ? show() ???? ???? HTML ??? ??? ??? ? ????.
??: ??
$(selector).hide(speed,callback) ;
$(selector).show(speed,callback);
???? ?? ????? ???/?? ??? ???? "??", "??" ?? ??? ?? ??? ? ????.
??? ?? ????? ??? ?? ??? ??? ? ??? ??? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").hide(1000); }); }); </script> </head> <body> <button>隱藏</button> <p>這是第一個</p> <p>這是第二個</p> </body> </html>
jQuery ??()
jQuery??? ??() ???? ???? hide() ? show() ???? ??? ? ????.
??? ?? ?? ? ??? ?? ???:
??:
$(selector).toggle(speed,callback);
???? ?? ????? ???/?? ??? ???? ?? ? ??? ?? ? ????. ?? ?? "??", "??" ?? ??????.
???? ?? ????? ??() ???? ??? ? ??? ??? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").toggle(); }); }); </script> </head> <body> <button>隱藏/顯示</button> <p>點(diǎn)擊一次隱藏</p> <p>再點(diǎn)擊一次顯示</p> </body> </html>