导航首页 » 技术教程 » jQuery过滤选择器经典应用
jQuery过滤选择器经典应用 72 2024-02-21   

本文实例为大家分享了经典的jQuery过滤选择器应用,供大家参考,具体内容如下

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>过滤选择器</title>
  <style type="text/css">
    #txt_show {display:none; color:#00C;}
    #txt_hide {display:block; color:#F30;}
  </style>
 
  <script src="http://www.gimoo.net/t/1901/js/jquery-1.8.3.js"></script>
  <script language="JavaScript">
    $(document).ready(function () {
      $("[name=show]").click(function () {
        $("p:hidden").show();
      }) ;
      $("[name=hide]").click(function () {
        $("p:visible").hide() ;
      });
    });
 
  </script>
 
</head>
<body>
<p id="txt_hide">点击按钮,我会被隐藏哦~</p>
<p id="txt_show">隐藏的我,被显示了,嘿嘿^^</p>
<input name="show" type="button" value="点击显示文字" />
<input name="hide" type="button" value="点击隐藏文字" />
 
</body>
</html>

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持绿夏网。



!!!站长长期在线接!!!

网站、小程序:定制开发/二次开发/仿制开发等

各种疑难杂症解决/定制接口/定制采集等

站长微信:lxwl520520

站长QQ:1737366103