1、点击 隐藏/显示 元素
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <link rel="stylesheet" type="text/css" href="css/demos.css" /> <script src="js/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript"> /*文档结构加载完成后,给2个按钮添加单击事件处理函数。*/ $(document).ready(function() { $(‘#id-button-show‘).click(function() { $(‘h3‘).show(); }); $(‘#id-button-hide‘).click(function() { $(‘h3‘).hide(); }) }); </script> </head> <body> <button type="button" id="id-button-show">显示</button> <button type="button" id="id-button-hide">隐藏</button> <hr /> <h3>这里是要操作的内容。</h3> </body> </html>
视图:
引用文件:
http://files.cnblogs.com/files/wanghaibin/demos.css
http://files.cnblogs.com/files/wanghaibin/jquery-1.9.1.js
时间: 2024-11-05 19:04:39