<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jq之demo</title> <!--线上jq库--> <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script> $(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>Goole</h3> <div class="ex"> <button class="hide">点我隐藏</button> <p>站点名:百度<br/> url:https://www.baidu.com/?tn=40020637_10_oem_dg </p> </div> <h3>w3c</h3> <div class="ex"> <button class="hide">点我隐藏</button> <p>站点名:b站<br/> url:https://www.bilibili.com/ </p> </div> </body> </html>
jq之div hide slow
最新推荐文章于 2023-09-14 18:51:30 发布