jQuery學習筆記(三) 效果
隱藏部分文本
<html> <head> <script type="text/javascript" src="jquery-1.7.1.js"></script> <script type="text/javascript"> $(document).ready(function() { $(".ex .hide").click(function() { $(this).parents(".ex").hide("slow"); }); }); </script> <style type="text/css"> div.ex { background-color:#e5eecc; padding:7px; border:solid 1px #c3c3c3; } </style> </head> <body> <h3>百度</h3> <div > <button type="button">Hide me</button> <p>百度一下,你就知道</p> </div> <h3>騰訊</h3> <div > <button type="button">Hide me</button> <p>麻花藤</p> </div> </body> </html>
最後更新:2017-04-02 06:52:22