jQuery过滤选择器经典应用


本文实例为大家分享了经典的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="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>

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


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3