jquery的toggle()函数,显示/隐藏交替
<!DOCTYPE html> <html lang="en"> <head> <script src="jquery.js"></script> <meta charset="UTF-8"> <title>lfj</title> <style> .one { background-color:yellow; } .two { background-color: pink; } </style> </head> <body> <div class='one'> one </div> <div class="two"> two </div> </body> <script> $(".one").click(function(){ $(".two").toggle(); }) </script> </html>