toggleClass 实现属性的反转
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> .hide{ display: none; } </style> </head> <body> <div class="hide">asdads</div> <input id="i1" type="button" value="开关"> <script src="../jquery-2.12.4.js"></script> <script> $('#i1').click(function () { $('div').toggleClass('hide') }) </script> </body> </html>