隐藏部分文本
<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 class="ex"> <button class="hide" type="button">Hide me</button> <p>百度一下,你就知道</p> </div> <h3>腾讯</h3> <div class="ex"> <button class="hide" type="button">Hide me</button> <p>麻花藤</p> </div> </body> </html>
时间: 2024-10-31 04:21:04